jhipsterstompjs

disable stomp debug output in jhipster


I am sitting here for hours to find out how I can disable the debug output of stomp.js.

I am actually getting this output in development + production environment:

Web Socket Opened...
webstomp.js?afe9:238 >>> CONNECT
accept-version:1.2,1.1,1.0
heart-beat:10000,10000

�
webstomp.js?afe9:238 >>> length 60
webstomp.js?afe9:238 <<< CONNECTED
version:1.2
heart-beat:0,0
user-name:coach

�
webstomp.js?afe9:238 connected to server undefined
webstomp.js?afe9:238 >>> SEND
destination:/topic/activity
content-length:12

{"page":"/"}�
webstomp.js?afe9:238 >>> length 65
webstomp.js?afe9:238 >>> SEND
destination:/topic/activity
content-length:35

{"page":"/coach/client-management"}�
webstomp.js?afe9:238 >>> length 88

Is there a way to turn this off?

..

Thanks for your help!


Solution

  • You can disable the stomp debug method by declaring this.stompClient.debug = () => {} wherever you declare the this.stompClient. By default for a JHipster app, this is in src/main/webapp/app/core/tracker/TrackerService.js

        const socket = new SockJS(url);
        this.stompClient = Stomp.over(socket);
        // add this line
        this.stompClient.debug = () => {}
        const headers = {};
        this.stompClient.connect(headers, () => {
        ....
    

    You can find more information about how to use the debug method in the STOMP docs:

    The client can set its debug property to a function which takes a String argument to see all the debug statements of the library:

    By default, the debug messages are logged in the browser window's console.