As the title says: you can find more context in the #3120 discussion.
Planning to merge quite soon, unless there's objections. When that happens, I'll backport the fix to 0.x too.
I'll push my changes to a PR, which have these enhancements to what your PR here does:
Supports multiple messages in a single websocket message
From my analysis of the code we have that results in this case, it's the underlying websocket message handling that is merging our janus requests into one websocket message. From what I'm being told this is a 'feature' of websockets.
The error I'm returning has the JSON issue reported, which aids in debugging bad requests immensely.
I did this by skipping the queue when the message is null, but still processing a request.
Please do let me know if there are any issues with reporting results from the websocket messaging thread for this error case. We could cache the error information instead, if necessary.
As the title says: you can find more context in the #3120 discussion. Planning to merge quite soon, unless there's objections. When that happens, I'll backport the fix to
0.x
too.