WithReadTimeout sets timeout duration for WebSocket connection reads. By default no timeout is used.
(timeout time.Duration)
| 98 | // |
| 99 | // By default no timeout is used. |
| 100 | func (ws *Websocket) WithReadTimeout(timeout time.Duration) *Websocket { |
| 101 | opChain := ws.chain.enter("WithReadTimeout()") |
| 102 | defer opChain.leave() |
| 103 | |
| 104 | if opChain.failed() { |
| 105 | return ws |
| 106 | } |
| 107 | |
| 108 | ws.readTimeout = timeout |
| 109 | |
| 110 | return ws |
| 111 | } |
| 112 | |
| 113 | // WithoutReadTimeout removes timeout for WebSocket connection reads. |
| 114 | func (ws *Websocket) WithoutReadTimeout() *Websocket { |