-
Notifications
You must be signed in to change notification settings - Fork 534
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
Feature request: support web assembly target #585
Comments
Thanks for the PR on this. Have you been able to successfully run your modified version of the library within a browser? I'm really interested in feedback on this change from those using Websockets (because I don't). Whilst the Gorilla Websocket package is looking for a new maintainer it's still fairly active, widely used (github stats say used by 45.3k projects) and stable. Gorilla websockets uses the BSD 2-Clause "Simplified" License and |
Yes, I have been using it to actually run the application described in this blog inside a browser: https://fynelabs.com/2022/01/10/easy-mqtt-application-with-fyne/ . I don't have a convenient way to host it at the moment, but if that would help, I could figure out a place to host it. |
Thanks @Bluebugs - just wanted to confirm that it was all working (as I have not tried using this with tinygo/WASM). |
Sorry, I have been using go main compiler not tinygo. tinygo is on my list of things to experiment with, but I haven't gotten to it yet. |
Anything I could do to help get this issue move forward? |
@Bluebugs adding some tests is likely to speed up the process (without these I'll have to test manually). Having said that I don't see a reason to rush this because there is a workaround (use My aim would be to make a new release before accepting this. It's a relatively major change so I'd like to see it used by those pulling |
@MattBrittan how would you recommend me going at those tests. Do you have a mqtt server setup with websocket I can use in the context of the automated tests? |
@Bluebugs yep. The tests are on the |
Ok, I will look into that in a week or so as I have a lot for next week. |
I've had another quick look at this. My main concern is that 6327808 sample.exe <- master So that's a 12% increase (around 800kb) with the move to Note: If any serious issues are identified with the gorilla package then I'd be happy to move (but do note that a new version of that package was released in Feb). |
I didn't realize this would have been a concern as this module doesn't compile with tinygo last time I checked. I would be interested to see with a real application how much that does really represent as the sample application doesn't do very much, but I understand your concern. I will try to see how it fair with SetCustomOpenConnectionFn. |
Thanks - please let me know how you get on (would be happy for such a module to be contributed; might add a plug-in folder off the repo for this kind of thing). |
It should be possible to support web assembly as a target for this library. The only way to support wasm target is to use a websocket library that support it as a target.
The current websocket library github.com/gorilla/websocket does not support and won't support wasm soon (gorilla/websocket#432). gorilla/websocket is also looking for a maintainer (gorilla/websocket#370) even if still does see some development activity (https://github.com/gorilla/websocket/graphs/code-frequency).
github.com/nhooyr/websocket does have support for wasm and is actively maintained. The library is also simpler and follow go net API more closely. It will actually simplify this library code switching to this other websocket library. The work for just a change can be seen here: 583
The text was updated successfully, but these errors were encountered: