mirror of
https://github.com/yudai/gotty.git
synced 2026-02-07 09:01:48 +01:00
Support auto reconnection
A new option `--auto-reconnect` which takes seconds to reconnect is added.
This commit is contained in:
parent
4df9ac8059
commit
acacba6f03
6 changed files with 97 additions and 55 deletions
|
|
@ -28,9 +28,10 @@ const (
|
|||
)
|
||||
|
||||
const (
|
||||
Output = '0'
|
||||
SetWindowTitle = '1'
|
||||
SetPreferences = '2'
|
||||
Output = '0'
|
||||
SetWindowTitle = '1'
|
||||
SetPreferences = '2'
|
||||
SetAutoReconnect = '3'
|
||||
)
|
||||
|
||||
type argResizeTerminal struct {
|
||||
|
|
@ -124,6 +125,17 @@ func (context *clientContext) sendInitialize() error {
|
|||
writer.Write(prefs)
|
||||
writer.Close()
|
||||
|
||||
if context.app.options.AutoReconnect >= 0 {
|
||||
autoReconnect, _ := json.Marshal(context.app.options.AutoReconnect)
|
||||
writer, err = context.connection.NextWriter(websocket.TextMessage)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
writer.Write([]byte{SetAutoReconnect})
|
||||
writer.Write(autoReconnect)
|
||||
writer.Close()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue