stompjs
stompjs copied to clipboard
Client has been marked inactive, will not attempt to connect.
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")
// }
});
Please attach your full log.
@kum-deepak Thank you for responding...
am not able to connect with the stomp.
Please attache your entire log - from the very beginning. In this case, the error might have occurred a while back.
@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.