Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websocket Wrong Control Frame #23825

Closed
tshradheya opened this issue Mar 8, 2019 · 7 comments
Closed

Websocket Wrong Control Frame #23825

tshradheya opened this issue Mar 8, 2019 · 7 comments
Labels
Bug Resolution: Locked This issue was locked by the bot.

Comments

@tshradheya
Copy link

tshradheya commented Mar 8, 2019

🐛 Bug Report

Very frequent websocket: control frame length > 125 messages recieved by server due to react native websockets

This is probably due to pong sent by react native client as response to ping message.
Close code is 1002

To Reproduce

Connect to websocket and keep recieving messages with server sending pings.

        this.socket.onclose = (e) => {
            alert('Socket closed.' + e.code + ' Reason: ' + e.reason);
        };

This gives code 1002

Expected Behavior

Should not be giving wrong data in pong and not disconnect very so often.
1002 indicates a protocol error, which may be caused by packet loss (lossy internet connection) or malformed packets sent by your websocket library.

Code Example

Environment

React Native Environment Info:
    System:
      OS: macOS 10.14.1
      CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
      Memory: 1.36 GB / 16.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 8.9.4 - ~/.nvm/versions/node/v8.9.4/bin/node
      Yarn: 1.13.0 - ~/.nvm/versions/node/v8.9.4/bin/yarn
      npm: 5.6.0 - ~/.nvm/versions/node/v8.9.4/bin/npm
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
    IDEs:
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: ^0.58.5 => 0.58.5 
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native: 0.56.0
@react-native-bot

This comment has been minimized.

@tshradheya
Copy link
Author

Any update on this?

@tshradheya
Copy link
Author

@react-native-bot ??

@react-native-bot
Copy link
Collaborator

It looks like you are using an older version of React Native. Please update to the latest release, v0.59 and verify if the issue still exists.

The "Resolution: Old Version" label will be removed automatically once you edit your original post with the results of running react-native info on a project using the latest release.

@tshradheya
Copy link
Author

There is no ios specefic fixes for websocket in 0.59 so dont want to update unnecessarily.

@tshradheya tshradheya changed the title Websocket Closing Abnormally very often Websocket Wrong Control Frame Mar 13, 2019
@tshradheya
Copy link
Author

I read this somewhere: When you get a ping, send back a pong with the exact same Payload Data as the ping (for pings and pongs, the max payload length is 125).

Could this be possible because my client is getting almost 10+ messages every second and it might have confused the message data and put that in the pong data it sent?

@tshradheya
Copy link
Author

@hramos Any idea on if this is a possible bug in React native websocket library

@facebook facebook locked as resolved and limited conversation to collaborators Mar 15, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants