write writes a message with the given message type and payload.
(mt int, payload []byte)
| 102 | |
| 103 | // write writes a message with the given message type and payload. |
| 104 | func (c *connection) write(mt int, payload []byte) error { |
| 105 | |
| 106 | deadline := tz.Now().Add(writeWait) |
| 107 | |
| 108 | if err := c.ws.SetWriteDeadline(deadline); err != nil { |
| 109 | c.logWarn(err, "Cannot set write deadline") |
| 110 | } |
| 111 | |
| 112 | return c.ws.WriteMessage(mt, payload) |
| 113 | } |
| 114 | |
| 115 | // writePump pumps messages from the hub to the websocket connection. |
| 116 | func (c *connection) writePump() { |
no test coverage detected