diff options
Diffstat (limited to 'internal/net/wsconn.go')
| -rw-r--r-- | internal/net/wsconn.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/internal/net/wsconn.go b/internal/net/wsconn.go index 34663ba..29d1947 100644 --- a/internal/net/wsconn.go +++ b/internal/net/wsconn.go @@ -38,8 +38,18 @@ func (w *wsConn) Close() error { } func (w *wsConn) SetEcho(on bool) error { + return w.conn.WriteMessage(websocket.TextMessage, w.EchoSequence(on)) +} + +// EchoSequence returns the browser echo-control bytes for the websocket +// transport; queued sessions send these through the session writer so a +// stalled browser cannot block the caller (see Session.SetEcho). +func (w *wsConn) EchoSequence(on bool) []byte { if on { - return w.conn.WriteMessage(websocket.TextMessage, []byte("\x1b]10;0\x07")) + return []byte("\x1b]10;0\x07") } - return w.conn.WriteMessage(websocket.TextMessage, []byte("\x1b]10;1\x07")) + return []byte("\x1b]10;1\x07") } + +// SetEchoState is a no-op: the websocket transport keeps no local echo state. +func (w *wsConn) SetEchoState(bool) {} |
