I'm having some troubles doing this exact connection in go-lang.
Thus far, I've done:
u := url.URL{Scheme: "wss", Host: "streamer.cryptocompare.com"}
var dialer *websocket.Dialer
conn, _, err := dialer.Dial(u.String(), nil)
l.Log(err)
msg, err := json.Marshal(Message{"SubAdd", map[string]interface{}{"subs": []string{"5~CCCAGG~BTC~USD"}}})
l.Log(err)
err = conn.WriteMessage(websocket.TextMessage, msg)
fmt.Println(err.Error())
l.Log(err)
I'm still learning about websockets, and how to use them.
Edit: This is the error, I'm getting:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x718937]
goroutine 22 [running]:
github.com/gorilla/websocket.(*Conn).WriteMessage(0x0, 0x1, 0xc420248020, 0x36, 0x40, 0x0, 0x0)
/home/avl/go/src/github.com/gorilla/websocket/conn.go:734 +0x37
main.SetupSockets(0xc420058370)
/home/avl/Dropbox/Development/mixed/server/crypto.go:55 +0x378
created by main.main
/home/avl/Dropbox/Development/mixed/server/main.go:21 +0x9a
exit status 2
Edit 2: Line 55 in crypto.go corresponds to this msg, err := json.Marshal(Message{"SubAdd", map[string]interface{}{"subs": []string{"5~CCCAGG~BTC~USD"}}})