Invalid WebSocket frame: invalid payload length 126

Sometime I get this error. What is it and how to fix ?

  colyseus:errors RangeError: Invalid WebSocket frame: invalid payload length 126
  colyseus:errors     at Receiver.getInfo (/home/godate/node_modules/ws/lib/receiver.js:216:16)
  colyseus:errors     at Receiver.startLoop (/home/godate/node_modules/ws/lib/receiver.js:130:22)
  colyseus:errors     at Receiver._write (/home/godate/node_modules/ws/lib/receiver.js:77:10)
  colyseus:errors     at doWrite (_stream_writable.js:415:12)
  colyseus:errors     at writeOrBuffer (_stream_writable.js:399:5)
  colyseus:errors     at Receiver.Writable.write (_stream_writable.js:299:11)
  colyseus:errors     at TLSSocket.socketOnData (/home/godate/node_modules/ws/lib/websocket.js:876:35)
  colyseus:errors     at TLSSocket.emit (events.js:197:13)
  colyseus:errors     at addChunk (_stream_readable.js:288:12)
  colyseus:errors     at readableAddChunk (_stream_readable.js:269:11)
  colyseus:errors     at TLSSocket.Readable.push (_stream_readable.js:224:10)
  colyseus:errors     at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:145:17) +0ms```

hi @boygiandi, which client are you using?

React native, When I got this error I'm testing on iOS simulator. It just happen sometime.

I see, is this error crashing the server, or it just prints this error and server continues running?

I've never seen this, but here the author of the ws package explains what this error means: https://github.com/websockets/ws/issues/1662#issuecomment-555526971

Yes. It crash server

Ah.. I'm sorry. I didn't make server crash. Just make the client disconnected.

@endel Is there any way to fix it ?

I confirm the problem in react native (ios sim, 13.3). For me it just disconnects the client randomly, but server runs normally after the error; it just reports error to stdout.

I have same problem with JS client. Can be this caused by large state?

It seem like not only colyseus server is affected:

https://github.com/parse-community/parse-server/issues/6173
https://github.com/parse-community/parse-server/issues/6413

I created a bug for colyseus to handle this particular error in graceful way and keep clients connected:
https://github.com/colyseus/colyseus/issues/364