blob: 84852c548265f0b5ca2b107055d97c7fb30cacec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
package utils
import (
"encoding/json"
"net"
"github.com/gopherjs/websocket"
)
func WsDial(addr string) (c net.Conn, err error) {
c, err = websocket.Dial(addr)
return
}
func WsJsonSend(c net.Conn, o any) (err error) {
enc := json.NewEncoder(c)
err = enc.Encode(o)
return
}
|