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

Fix Websocket implementation in React Native #607

Merged
merged 1 commit into from
Jan 20, 2019

Conversation

bensalilijames
Copy link
Contributor

Note: the engine.io.js file is the generated output of make engine.io.js, and should not be manually modified.

The kind of change this PR does introduce

  • a bug fix
  • a new feature
  • an update to the documentation
  • a code change that improves performance
  • other

Current behaviour

In React Native, using the WebSocket transport with socket.io fails. This is because self is undefined, so it tries to load in the ws Node.js library. It should use the native RN WebSocket instead.

New behaviour

This ensures the correct WebSocket global is used.

Other information (e.g. related issues)

Fixes: https://stackoverflow.com/questions/53650676/expo-with-socket-io-websocket-failing-to-connect

@darrachequesne darrachequesne merged commit 1ec53d4 into socketio:master Jan 20, 2019
@darrachequesne
Copy link
Member

@benhjames thanks for the fix!

I'm wondering whether we could add some tests to ensure that the library works properly in React Native.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants