Invalid WebSocket frame on iOS (React Native)
See original GitHub issueSteps to Reproduce (for bugs)
- Use React Native client on iOS
- Send some data to server
- Sometimes following error occurs:
Invalid WebSocket frame: invalid payload length 126
RangeError: Invalid WebSocket frame: invalid payload length 126
at Receiver.getInfo (/Users/s/Projects/sp/server/node_modules/ws/lib/receiver.js:216:16)
at Receiver.startLoop (/Users/s/Projects/sp/server/node_modules/ws/lib/receiver.js:127:22)
at Receiver._write (/Users/s/Projects/sp/server/node_modules/ws/lib/receiver.js:74:10)
at doWrite (_stream_writable.js:415:12)
at writeOrBuffer (_stream_writable.js:399:5)
at Receiver.Writable.write (_stream_writable.js:299:11)
at Socket.socketOnData (/Users/s/Projects/sp/server/node_modules/ws/lib/websocket.js:875:35)
at Socket.emit (events.js:193:13)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:276:11)
Context
This error then causes client to disconnect. This issue relates to some websocket internals and I found some of them in other server projects: https://github.com/parse-community/parse-server/issues/6413 https://github.com/parse-community/parse-server/issues/6173
As for colyseus clients, we have this related ticket: https://github.com/colyseus/colyseus-hx/issues/33
Your Environment
- Colyseus Version: 0.13.5
- Node.js Version: 11.14.0
- Operating System and version: Mac, FreeBSD
- Link to your project: none yet
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:12 (2 by maintainers)
Top Results From Across the Web
Invalid WebSocket frame on iOS (React Native) - Bountysource
Use React Native client on iOS; Send some data to server; Sometimes following error occurs: Invalid WebSocket frame: invalid payload length ...
Read more >Invalid WebSocket frame: invalid payload length 126
I confirm the problem in react native (ios sim, 13.3). For me it just disconnects the client randomly, but server runs normally after...
Read more >Invalid Websockets frame error while using react-router-dom. I ...
Changing a tag to Link element solved this problem in my case.
Read more >Invalid Hook Call Warning - React
You might be using a version of react-dom (< 16.8.0) or react-native (< 0.59) that doesn't yet support Hooks. You can run npm...
Read more >Using Spring Boot for WebSocket Implementation with STOMP
The WebSocket protocol is a rather low-level protocol. It defines how a stream of bytes is transformed into frames. A frame may contain...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Let’s keep this issue open, maybe this will pop in the future…
Hey yes, it’s RN with iOS only. Upvoted issue you referred, thanks! Perhaps this one can be closed then. btw, I think it’s better to use
pingTimeout
instead.