stompjs icon indicating copy to clipboard operation
stompjs copied to clipboard

Client has been marked inactive, will not attempt to connect.

Open taj567 opened this issue 1 year ago • 4 comments

m not able to connect with the socket using react native getting error like Client has been marked inactive, will not attempt to connect.

do anyone have solution... this is the codee & current versions am using:

"@stomp/stompjs": "^7.0.0", "react-native": "0.71.0",


   const client = new Client({
        brokerURL: `${SOCKET_BASE_URL}${token}`, // Replace with your STOMP broker URL
        reconnectDelay: 10000,
        heartbeatIncoming : 5000,
        heartbeatOutgoing : 5000,
        forceBinaryWSFrames : true,
        appendMissingNULLonIncoming : true,
        onConnect: function (frame) {
          console.log('Connected: ' + frame);
          // Subscribe to a destination
          client.subscribe('/topic/continue_watching', function (message) {
            console.log('Received message:', message.body);
          });
          // Send a message
          client.publish({
            destination: '/app/continue_watching',
            // headers: "content-type:application/json",
            headers: {'content-type': 'application/json'},
            body: {
              userId: data?.data?.account?.id,
              tenantId: 123456,
              accountId: data?.data?.account?.id,
              subscriptionId: 345678,
              videoId: id,
              type: 'sample_type',
              duration: 3600,
              retentionTime: 7200,
              modelId: 987654,
            },
          });
        },
        debug: function (str) {
          console.log(str, 'Debug__');
        },
        // onWebSocketError: (e) => {
        //   console.log(e,"onWebSocketError")
        // },
        // onDisconnect : e => {
        //   console.log(e, "onDisconnect")
        // },
        // onWebSocketError : (e) => {
        //   console.log(e,"onWebSocketError")
        // },
        // onDisconnect : e => {
        //   console.log(e, "onDisconnect")
        // },
        // logRawCommunication: e => {
        //   console.log(e,  "logRawCommunication")
        // },
        // onStompError : e => {
        //   console.log(e, "StompError")
        // },
        // debug : e => {
        //   console.log(e, "debug")
        // }
      });

taj567 avatar Nov 04 '23 15:11 taj567

Please attach your full log.

kum-deepak avatar Nov 04 '23 15:11 kum-deepak

@kum-deepak Thank you for responding...

Screenshot 2023-11-06 at 10 50 12 AM

am not able to connect with the stomp.

taj567 avatar Nov 06 '23 05:11 taj567

Please attache your entire log - from the very beginning. In this case, the error might have occurred a while back.

kum-deepak avatar Nov 06 '23 05:11 kum-deepak

@kum-deepak , Thanks after some research added added text-encoder.

followed this document https://stomp-js.github.io/guide/stompjs/rx-stomp/polyfills-for-stompjs.html.

taj567 avatar Nov 06 '23 07:11 taj567