WebSocketListener icon indicating copy to clipboard operation
WebSocketListener copied to clipboard

WebSocketMessageReadNetworkStream can only start with a Text or Binary frame, not Continuation

Open imanushin opened this issue 7 years ago • 2 comments

In case of working with Java Spring 5.0 Web Sockets, the following error was occurred:

WebSocketMessageReadNetworkStream can only start with a Text or Binary frame, not Continuation.

How this can be fixed?

This issue happens on the massive web socket messages receive, e.g. it is actual only for case, when multiple independent parallel connections (for the same socket client) receive ~10 000 messages.

imanushin avatar Aug 22 '18 14:08 imanushin

Hi,

It seems it is trying to read a message when an existing one is still being transferred. How long are the messages usually? Are you making sure the message is completely read (ie: the message stream is fully consumed). I am not very sure how this may happen. The size of the message when fails could be a good hint.

Cheers.

https://github.com/vtortola/WebSocketListener/blob/3464f80bf6f7b6773b3955c436523aa2db37ceb7/vtortola.WebSockets/Rfc6455/WebSocketMessageReadRfc6455Stream.cs#L27

vtortola avatar Aug 24 '18 20:08 vtortola

I think I understand, what was happened. I checked message type firstly, then I copied message entirely to the separate memory stream. I will replace order of these functions.

About the probability: 1 timer per 10 000 messages (average)

imanushin avatar Aug 27 '18 13:08 imanushin