diff --git a/router/websocket/message.go b/router/websocket/message.go index 8d5cebf..5186826 100644 --- a/router/websocket/message.go +++ b/router/websocket/message.go @@ -9,6 +9,7 @@ const ( SendServerLogsEvent = "send logs" SendCommandEvent = "send command" ErrorEvent = "daemon error" + JwtErrorEvent = "jwt error" ) type Message struct { diff --git a/router/websocket/websocket.go b/router/websocket/websocket.go index 8d947a3..45cc575 100644 --- a/router/websocket/websocket.go +++ b/router/websocket/websocket.go @@ -109,8 +109,8 @@ func (h *Handler) SendJson(v *Message) error { // Do not send JSON down the line if the JWT on the connection is not valid! if err := h.TokenValid(); err != nil { h.unsafeSendJson(Message{ - Event: ErrorEvent, - Args: []string{"could not authenticate client: " + err.Error()}, + Event: JwtErrorEvent, + Args: []string{err.Error()}, }) return nil @@ -244,8 +244,8 @@ func (h *Handler) HandleInbound(m Message) error { if m.Event != AuthenticationEvent { if err := h.TokenValid(); err != nil { h.unsafeSendJson(Message{ - Event: ErrorEvent, - Args: []string{"could not authenticate client: " + err.Error()}, + Event: JwtErrorEvent, + Args: []string{err.Error()}, }) return nil