I'm using websocket.NetConn. net.Conn docs say:
A deadline is an absolute time after which I/O operations fail with a timeout (see type Error) instead of blocking.
However this closes the connection 10s after the write, even if the write has already completed:
conn.SetWriteDeadline(time.Now().Add(10 * time.Second)
conn.Write([]byte("hello world"))