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

Change WebSocket dependency to be browser friendly #840

Closed
wants to merge 4 commits into from

Conversation

mikeb1rd
Copy link

Removed explicit dependency on ws, to instead use simple-websocket so that the connection works in node and the browser, and is now browserify friendly.

An example can be found here: https://github.com/mikeb1rd/ripple-lib-browser-client

@FredKSchott
Copy link
Contributor

@mikeb1rd ripple-lib already works in the browser, by replacing ws with wswrapper.ts (uses native browser WebSocket) during the browser build step. Is this not working for you?

@mikeb1rd
Copy link
Author

@FredKSchott If you use ripple-lib directly that's fine, but I was trying to use an npm module that has a dependency on ripple-lib (such as ilp-plugin-xrp-escrow or ilp-plugin-xrp-asym-client), and pull that into the browser using browserify. I'll have another think and see if using webpack works better.

@FredKSchott
Copy link
Contributor

FredKSchott commented Jan 28, 2018 via email

@intelliot
Copy link
Collaborator

intelliot commented Feb 7, 2018

@mikeb1rd See #847 for an alternate solution; hopefully that works with your browserify setup?

Using your above example (ripple-lib-browser-client), I built three versions of bundle.js.
[…]

As of bbfc53e, the solution in #847 is substantially similar to the one you've provided here, the only difference being that we use our pre-existing wswrapper shim.

@intelliot
Copy link
Collaborator

To test it out, you can have a look at my fork of your example: intelliot/ripple-lib-browser-client@89ce3e8

Other than using the browser-in-package-json branch of ripple-lib, there are no changes to your code.

@mikeb1rd
Copy link
Author

Closed in favour of #847

@mikeb1rd mikeb1rd closed this Feb 11, 2018
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.

3 participants