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

Detect React-Native environment and use all websocket features #591

Merged
merged 1 commit into from
Nov 2, 2018

Conversation

cthayer
Copy link
Contributor

@cthayer cthayer commented Feb 11, 2018

React-Native provides a Websocket object that is more functionally aligned with the Node.js websocket than the browser websocket.

It has the same constructor signature as the Node.js websocket and can support extraHeaders and protocols.

This PR will detect when the engine.io-client is running in React-Native, call the proper Websocket constructor, and enable support for extraHeaders.

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

When running engine.io-client in a React-Native environment, the websocket transport cannot use extraHeaders.

New behaviour

When running engine.io-client in a React-Native environment, the websocket transport can use extraHeaders

Other information (e.g. related issues)

React-Native provides a Websocket object that is more functionally aligned with the Node.js websocket than the browser websocket.

It has the same constructor signature as the Node.js websocket and can support extraHeaders and protocols.

This PR will detect when the engine.io-client is running in React-Native, call the proper Websocket constructor, and enable support for extraHeaders.
@cthayer
Copy link
Contributor Author

cthayer commented Feb 11, 2018

Most of the travis build jobs passed. As best I can tell, the ones that failed don't seem to have failed due to the code changes in this PR

@darrachequesne darrachequesne added this to the 3.3.0 milestone Nov 2, 2018
@darrachequesne darrachequesne changed the base branch from master to develop November 2, 2018 06:43
@darrachequesne darrachequesne merged commit 47105cf into socketio:develop Nov 2, 2018
@darrachequesne
Copy link
Member

Thanks 👍

darrachequesne pushed a commit that referenced this pull request Nov 2, 2018
…#591)

React-Native provides a Websocket object that is more functionally aligned with the Node.js websocket than the browser websocket.

It has the same constructor signature as the Node.js websocket and can support extraHeaders and protocols.

This PR will detect when the engine.io-client is running in React-Native, call the proper Websocket constructor, and enable support for extraHeaders.
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