WriteWithDeadline writes a text message to the session with a custom write deadline. If deadline is 0, uses Config.WriteWait.
(msg []byte, deadline time.Duration)
| 269 | // WriteWithDeadline writes a text message to the session with a custom write deadline. |
| 270 | // If deadline is 0, uses Config.WriteWait. |
| 271 | func (s *Session) WriteWithDeadline(msg []byte, deadline time.Duration) error { |
| 272 | if s.closed() { |
| 273 | return ErrSessionClosed |
| 274 | } |
| 275 | |
| 276 | s.writeMessage(envelope{ |
| 277 | t: websocket.TextMessage, |
| 278 | msg: msg, |
| 279 | writeWait: deadline, |
| 280 | }) |
| 281 | |
| 282 | return nil |
| 283 | } |
| 284 | |
| 285 | // WriteBinaryWithDeadline writes a binary message to the session with a custom write deadline. |
| 286 | // If deadline is 0, uses Config.WriteWait. |