Is it possible to write a Websocket client in wasm over go? I have tried using gorilla/websocket
, but no success:
func main() {
ws := func(this js.Value, inputs []js.Value) interface{} {
go func() {
wsDial, r, err := websocket.DefaultDialer.Dial("ws://localhost:3000/ws", nil)
fmt.Println(wsDial, r, err)
}()
return nil
}
js.Global().Set("ws", js.FuncOf(ws))
select {}
}
I get the following error when calling ws()
:
dial tcp: Protocol not available