restbed icon indicating copy to clipboard operation
restbed copied to clipboard

Websockets failing to receive large messages

Open cpatzuk-russell opened this issue 5 years ago • 2 comments

Large messages, above 65535 characters, fail to be parsed from browser to server. However, they are successfully sent from server to browser.

cpatzuk-russell avatar Mar 10 '21 00:03 cpatzuk-russell

Do you have a stack trace or any further information? What have you tried so far to root cause the issue?

ben-crowhurst avatar May 13 '21 00:05 ben-crowhurst

Unfortunately we've already taken out restbed and switched to mongoose so I don't have a call stack for you, but all you need to do is send a message larger that 65535 characters through a websocket connection to reproduce it, this example will do https://github.com/Corvusoft/restbed/blob/c587e26a5c5e97c4d7a8321bb8e7e4faf2ae6225/documentation/example/WEB_SOCKET.md. I started to try to fix it but there were multiple bugs in WebSocketManagerImpl::parse so I gave up. For starters here is one that I remember. Not only are you just setting it equal to the last bit shift, you're not doing the full 64 bits in the longer message length case. https://github.com/Corvusoft/restbed/blob/c587e26a5c5e97c4d7a8321bb8e7e4faf2ae6225/source/corvusoft/restbed/detail/web_socket_manager_impl.cpp#L112 WebSocketManagerImpl::compose, however, did seem to work correctly with longer messages.

cpatzuk-russell avatar May 13 '21 04:05 cpatzuk-russell