mirror of
https://github.com/sorenisanerd/gotty.git
synced 2024-11-22 12:24:25 +00:00
Use WriteMessage
to simplify
This commit is contained in:
parent
c71cc21721
commit
02e0b6fafd
@ -127,23 +127,17 @@ func (context *clientContext) sendInitialize() error {
|
|||||||
writer.Close()
|
writer.Close()
|
||||||
|
|
||||||
prefs, _ := json.Marshal(context.app.preferences)
|
prefs, _ := json.Marshal(context.app.preferences)
|
||||||
writer, err = context.connection.NextWriter(websocket.TextMessage)
|
context.connection.WriteMessage(
|
||||||
if err != nil {
|
websocket.TextMessage,
|
||||||
return err
|
append([]byte{SetPreferences}, prefs...),
|
||||||
}
|
)
|
||||||
writer.Write([]byte{SetPreferences})
|
|
||||||
writer.Write(prefs)
|
|
||||||
writer.Close()
|
|
||||||
|
|
||||||
if context.app.options.EnableReconnect {
|
if context.app.options.EnableReconnect {
|
||||||
reconnect, _ := json.Marshal(context.app.options.ReconnectTime)
|
reconnect, _ := json.Marshal(context.app.options.ReconnectTime)
|
||||||
writer, err = context.connection.NextWriter(websocket.TextMessage)
|
context.connection.WriteMessage(
|
||||||
if err != nil {
|
websocket.TextMessage,
|
||||||
return err
|
append([]byte{SetReconnect}, reconnect...),
|
||||||
}
|
)
|
||||||
writer.Write([]byte{SetReconnect})
|
|
||||||
writer.Write(reconnect)
|
|
||||||
writer.Close()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user