question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid WebSocket frame on iOS (React Native)

See original GitHub issue

Steps to Reproduce (for bugs)

  1. Use React Native client on iOS
  2. Send some data to server
  3. 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:open
  • Created 3 years ago
  • Reactions:3
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
endelcommented, Sep 24, 2020

Let’s keep this issue open, maybe this will pop in the future…

2reactions
serjekcommented, Sep 24, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found