ignoreWebSocketReaders ignores all incoming WS messages on conn. This is required by the underlying library if we don't care about sent messages. This implementation was borrowed from gorilla's docs: https://godoc.org/github.com/gorilla/websocket#hdr-Control_Messages
(conn *websocket.Conn)
| 94 | // This implementation was borrowed from gorilla's docs: |
| 95 | // https://godoc.org/github.com/gorilla/websocket#hdr-Control_Messages |
| 96 | func ignoreWebSocketReaders(conn *websocket.Conn) { |
| 97 | for { |
| 98 | if _, _, err := conn.NextReader(); err != nil { |
| 99 | conn.Close() |
| 100 | return |
| 101 | } |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | // upgrader is used to upgrade an HTTP connection to a Websocket connection. |
| 106 | var upgrader = websocket.Upgrader{ |