websocket icon indicating copy to clipboard operation
websocket copied to clipboard

Support both WASM and GopherJS

Open jancona opened this issue 5 years ago • 5 comments

This PR is based on @nightexcessive's wasm branch (see #27). It:

  • Replaces gopherwasm/js with Go 1.12 syscall/js
  • Uses gopherjs 1.12-2's support for syscall/js to make the WASM code work in GopherJS as well

Based on the discussions in #27, I made the main websocket package no longer depend on websocketjs. (I moved the necessary code into websocket.) websocketjs is kept unchanged for backwards compatibility, but is GopherJS-only. The end result should be that no breaking changes are made to the either package, but per @dmitshur's suggestion, the low-level websocketjs is not provided for WASM.

Let me know if you'd prefer that I make the PR against the wasm branch instead of master. I'm also happy to cleanup the commit history if you think that's appropriate.

jancona avatar Jul 05 '19 18:07 jancona

@jancona I've integrated WASM compilation into nhooyr.io/websocket v1.6.0, I think you'll find it useful.

nhooyr avatar Sep 22 '19 18:09 nhooyr

Thanks @nhooyr I'll take a look.

jancona avatar Sep 25 '19 01:09 jancona

This PR is currently broken on Go 1.13 because of https://github.com/golang/go/issues/32402. I can put together a fix, but I won't bother if there's no interest in merging this. Could someone associated with the project (@dmitshur or others) comment on whether this is worth pursuing?

jancona avatar Sep 25 '19 01:09 jancona

@johanbrandhorst What're your thoughts on this?

justinclift avatar Oct 22 '19 09:10 justinclift

I think it's worthwhile getting this in but I don't have merge access either unfortunately :(.

johanbrandhorst avatar Oct 22 '19 09:10 johanbrandhorst