-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Null-pointer when calling subscribe() #462
Comments
Please enable debug and attach the full console output. |
I would need some time to reproduce this issue. Since it was reported by Sentry means that it happened in a production environment. I'll still have to figure out why the connection was disposed. From what I could see from the source code, Stomp does not check if I would add an invariant there that produces a better error message. |
@sbaechler were you able to solve the problem? If yes, please share how did you did it as I'm also facing the same issue. |
Are there any updates on this issue? |
A long discussion on seemingly a simple issue. The underlying STOMP connection is not guaranteed to be always there - it may vanish at any time. The reconnection logic will trigger upon discovering the loss of connection, however, there would be spans without an underlying connection. In addition, the subscriptions do not survive disconnects and need to be reestablished on successful reconnects. So, the user code must check and should be willing to handle these scenarios. This can make the user code quite clumsy. To simplify these, a few years back I wrote a wrapper for this library https://github.com/stomp-js/rx-stomp. This version exposes an alternate semantics:
In my opinion when using from a long-running application (an App or SPA) Based on feedback, I may write an article in greater depth. |
I was getting a TypeError: Cannot read properties of undefined (reading 'subscribe'):
We pause subscriptions before a batch action that can trigger mutliple websocket events and resume them once the batch is done. In that case that was after 2 seconds.
For this we call
unsubscribe
on the subscriptions andsubscribe
shortly after.I guess for some reason
_disposeStompHandler
was called in between.The text was updated successfully, but these errors were encountered: