websocket force closed on first incoming message #935
-
I tried to put together a simple test where a browser opens a page from localhost and sends a message to the server via ws. The handshake is fine and the connection opens. At the moment of the browser sending a message the connection abruptly closes. This happens in Chrome, Firefox, IE Edge on Windows 10 and on Ubuntu Linux. Tried another WS library to check (https://www.npmjs.com/package/ws). That one didnt close the connection. When the uWebSockets server sends a message, the connection stays alive and the message is delivered. It only doesnt work client -> server for me. This is the whole "project": server: nodejs v10.15.1
index.html(the 'client'):
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@alexhultman after further investigation it looks like |
Beta Was this translation helpful? Give feedback.
-
Ah, yes it defaults to 0 which is a pretty bad value. |
Beta Was this translation helpful? Give feedback.
@alexhultman after further investigation it looks like
maxPayloadLength
is mandatory, and if set, it works. I've set it to 16 and the server accepted the client's 'hello' message and the connection stayed open.