|
@@ -175,14 +175,20 @@ func loginHandler(conn *websocket.Conn, msg []byte, payload structs.WsPayload) e
|
|
|
|
|
|
|
|
// broadcast the unauth payload
|
|
// broadcast the unauth payload
|
|
|
func unauthHandler(conn *websocket.Conn, r *http.Request) {
|
|
func unauthHandler(conn *websocket.Conn, r *http.Request) {
|
|
|
- blob := structs.UnauthBroadcast
|
|
|
|
|
- blob.Type = "structure"
|
|
|
|
|
- blob.AuthLevel = "unauthorized"
|
|
|
|
|
- blob.Login = struct{
|
|
|
|
|
- Remainder: 0
|
|
|
|
|
|
|
+ blob := structs.UnauthBroadcast{
|
|
|
|
|
+ Type: "structure",
|
|
|
|
|
+ AuthLevel: "unauthorized",
|
|
|
|
|
+ Login: struct {
|
|
|
|
|
+ Remainder int `json:"remainder"`
|
|
|
|
|
+ }{
|
|
|
|
|
+ Remainder: 0,
|
|
|
|
|
+ },
|
|
|
|
|
+ }
|
|
|
|
|
+ resp, err := json.Marshal(blob)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ config.Logger.Error(fmt.Sprintf("Error unmarshalling message: %v", err))
|
|
|
}
|
|
}
|
|
|
- resp := json.Marshal(blob)
|
|
|
|
|
- if err := conn.WriteMessage(websocket.TextMessage, respJson); err != nil {
|
|
|
|
|
|
|
+ if err := conn.WriteMessage(websocket.TextMessage, resp); err != nil {
|
|
|
config.Logger.Error(fmt.Sprintf("Error writing response: %v", err))
|
|
config.Logger.Error(fmt.Sprintf("Error writing response: %v", err))
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|