-
Notifications
You must be signed in to change notification settings - Fork 311
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
Compile for WebAssembly #121
Comments
@nhooyr the API for My main motivation for a WebAssembly-compatible WebSockets library is to support running libp2p/go-ws-transport in the browser. I have already made that possible with libp2p/go-ws-transport#51. It's hard to justify spending time on a different approach when we already found one that works. That said, we could potentially reduce the maintenance burden for libp2p/go-ws-transport by changing it to use this package and abstracting away the Wasm/JavaScript related code. I don't know how open the libp2p team would be to that idea. If we were to go this route, another important thing to consider is browser compatibility and backwards compatibility for anyone still using Have you done any testing to see if this package is compatible with browsers and/or |
That would be fantastic.
I meant in terms of API, but yes they both can talk to each other just fine.
Yes, I've done extensive research and experimentation. You can see it all in the issue history. I've read gorilla/websocket's source and issue tracker nearly completely. We use this library at https://coder.com, it fully passes the autobahn test suite (which tests compatibility between WebSocket implementations), has a solid array of tests and 35 or so unique cloners a day (400 clones usually) so it is used in the wild. |
Oh my bad, I misread your response. You're asking whether it's compatible with the browser API. Definitely only a subset would work but I'll take a closer look tonight and get back to you. |
@nhooyr Sorry I wasn't super clear. I'm actually asking about connection compatibility. Can you dial from a browser to a server that is using |
Yea, will work fine. |
The API's that will need to be removed when compiling for WASM:
It'd be an extremely stripped down API. |
I'm not sure if this will be worth it given those considerations. It'd require refactoring the code quite awkwardly wherever the WASM splits are required and involve quite a bit of complexity. I wonder if it'd be better to have a sub package |
So I'm convinced this is a good idea and shouldn't be too hard this weekend. |
Will ask https://github.com/gopherjs/websocket to be deprecated once this is done. |
Related: gopherjs/websocket#28 |
@albrow I saw you in issue gorilla/websocket#432 (comment)
If you'd like to contribute the necessary improvements to this library, I'd be more than happy to help, review and merge your changes.
The text was updated successfully, but these errors were encountered: