stompjs
stompjs copied to clipboard
TypeError: Cannot read property 'publish' of undefined when app goes on background for long
Getting error on publish when user send message after long time stying on the background. What could be the reason
if (stompClientState) { stompClientState.publish({ destination: "/app/subscribeUser", headers: { 'content-type': "application/json;charset=UTF-8" }, body: JSON.stringify(messageObj) });
}
The underlying connection may drop for various reasons, and the library will reconnect. However, occasionally, there may be no underlying connection. When using this library, you need to check, before operations, if there is an active broker connection.
If you find it complicated, the wrapper @stopm/rx-stomp hides this complexity among other goodies.