This commit is contained in:
Daniel Ponte 2022-12-21 13:22:26 -05:00
parent c424b75cf6
commit 14401c831a

View file

@ -23,15 +23,15 @@ var (
type Type string type Type string
type MsgBase struct { type MsgBase struct {
ID *int `json:"id,omitempty"` ID *int `json:"id,omitempty"`
Type Type `json:"type"` Type Type `json:"type"`
} }
type ( type (
wsSession struct { wsSession struct {
conn *websocket.Conn conn *websocket.Conn
b core.Blas b core.Blas
ec echo.Context ec echo.Context
write chan<- interface{} write chan<- interface{}
user *auth.User user *auth.User
@ -97,7 +97,7 @@ func (ws *wsSession) Go(ctx context.Context) error {
if err != nil { if err != nil {
return err return err
} }
_, rdr, err := ws.conn.NextReader() _, rdr, err := ws.conn.NextReader()
if err != nil { if err != nil {
return err return err
@ -213,13 +213,13 @@ func (ws *wsSession) handleMsg(ctx context.Context, msgMap map[string]interface{
idFl, ok := msgMap["id"].(float64) idFl, ok := msgMap["id"].(float64)
if !ok { if !ok {
ws.Write(WSError{ ws.Write(WSError{
Type: ResultMsgType, Type: ResultMsgType,
Success: false, Success: false,
Error: Error{ Error: Error{
Code: "invalid_id", Code: "invalid_id",
Message: "command has no ID", Message: "command has no ID",
}, },
}) })
return nil return nil
} }