1 package ws
2
3 // Conn is an opaque handle to a WebSocket connection.
4 type Conn int
5
6 // Dial opens a WebSocket connection. Callbacks are JS callback IDs
7 // from dom.RegisterCallback. Returns connection handle.
8 func Dial(url string, onMessage func(int, string), onOpen func(int), onClose func(int, int, string), onError func(int)) Conn {
9 panic("jsbridge")
10 }
11
12 // Send sends a string message. Returns true if sent.
13 func Send(conn Conn, msg string) bool { panic("jsbridge") }
14
15 // Close closes the connection.
16 func Close(conn Conn) { panic("jsbridge") }
17
18 // ReadyState returns the WebSocket readyState.
19 // 0=CONNECTING, 1=OPEN, 2=CLOSING, 3=CLOSED, -1=invalid
20 func ReadyState(conn Conn) int { panic("jsbridge") }
21