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

x/net/websocket: add a web socket client when targeting js/wasm #27311

Open
definitelycarter opened this issue Aug 28, 2018 · 2 comments
Open

x/net/websocket: add a web socket client when targeting js/wasm #27311

definitelycarter opened this issue Aug 28, 2018 · 2 comments

Comments

@definitelycarter
Copy link

@definitelycarter definitelycarter commented Aug 28, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

v 1.11

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN="/Users/adamtcarter/go/bin"
GOCACHE="/Users/adamtcarter/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/adamtcarter/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/7h/f4ryg4z10xd13dy_qf221grc0000gn/T/go-build718587663=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Use web sockets in go while targeting js,wasm

What did you expect to see?

NA

What did you see instead?

NA

If it makes sense, please add a WebSocket client in x/net/websocket when targeting js,wasm. I was digging around some of the code and it looks like it would be possible by taking a similar approach to what was taken with http.Request calling the native browser fetch api. Let me know if it's viable and I can take a stab at it.

@gopherbot gopherbot added this to the Unreleased milestone Aug 28, 2018
@FiloSottile FiloSottile changed the title x/net/websocket add a web socket client when targeting js,wasm x/net/websocket: add a web socket client when targeting js/wasm Aug 30, 2018
@dennwc
Copy link
Contributor

@dennwc dennwc commented Oct 10, 2018

A working prototype: https://github.com/dennwc/dom/blob/master/net/ws/wsconn_js.go
Still need some work to support deadlines and addresses.

@agnivade
Copy link
Contributor

@agnivade agnivade commented Oct 14, 2019

@definitelycarter - https://godoc.org/nhooyr.io/websocket supports wasm now. Given that active development on x/net/websocket has nearly stopped, I would suggest you to use the package mentioned above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.