Websockets Next and streams with different message types #49107
starksm64
started this conversation in
Design Discussions
Replies: 1 comment
-
\CC @mkouba |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I happened across this websocket streams service:
https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-streams.md
and wanted to try hooking up the Quarkus websockets as their java library is a bit clunky. I'm able to do this, but I cannot deal with the initial response message to the subscribe attempt, or the response message if one unsubscribes as cleanly as I would like. I was hoping I could deal with this by having a generic text message callback along with the a callback with the expected unmarshalled type along the lines of:
This is not allowed. So instead I need to add an error callback and check the exception type:
I would rather not have to be checking against an exception type that does not seem a reliable api type. I have seen these types of streaming services be very lax in what they put in even the expected object messages, so deserialization issues are a common occurrence.
What if instead of using the
onError
method or a general@OnTextMessage
handler, the webservices framework supported a@OnSerializationError
callback to distinguish from the expected text message type and a connection level error?Beta Was this translation helpful? Give feedback.
All reactions