nhooyr / websocket

Minimal and idiomatic WebSocket library for Go
ISC License
3.58k stars 272 forks source link

WASM #15

Closed nhooyr closed 5 years ago

nhooyr commented 5 years ago

https://github.com/golang/go/issues/27311

Can't really support the current API, browser API is different and much less expressive.

nhooyr commented 5 years ago

Probably a good idea to wait until the wasm support becomes more mature.

nhooyr commented 5 years ago

Don't really think this is worth doing. Based on the current js API, I don't think Go has a shot at becoming a solid frontend language so I wouldn't want to spend time on this.

nhooyr commented 5 years ago

See https://github.com/gorilla/websocket/issues/432

nhooyr commented 5 years ago

Definitely open to revisiting this in the future when WASM support is more mature.

nhooyr commented 5 years ago

Nvm, I think I this should be done. See https://www.reddit.com/r/golang/comments/b6y4h4/vugu_a_modern_ui_library_for_gowebassembly/

People do want to write frontend's in Go, I get it, the JS eco system isn't really good.

nhooyr commented 5 years ago

Not 100% sure on this now as passing a custom net/http client will not work.

nhooyr commented 5 years ago

I guess it'd just become a no-op. Seems janky for sure though but a lot of Go probably doesn't work in wasm so it should be fine.

nhooyr commented 5 years ago

Another issue is that the browser has a websocket status code for when the tls handshake fails whereas we just return the handshake error and we can't return a *http.Response from Dial.

nhooyr commented 5 years ago

I don't think this is worth it, lets revisit in the future.