diff --git a/ws/context_value.go b/ws/context_value.go index 4aa5111..bcdc6eb 100644 --- a/ws/context_value.go +++ b/ws/context_value.go @@ -33,11 +33,7 @@ func (v *Value) Raw() any { } func (v *Value) IsNil() bool { - if v.data == nil { - return true - } - - return false + return v.data == nil } func (v *Value) String() string { diff --git a/ws/dispatcher.go b/ws/dispatcher.go index e75a906..b8bcaab 100644 --- a/ws/dispatcher.go +++ b/ws/dispatcher.go @@ -43,11 +43,11 @@ func Dispatcher(c *Client, request string) { c.LastHeartbeatTime = t } - handlers := InitManager().Handlers(req.Action) - if handlers == nil || len(handlers) == 0 { - c.SendActionMsg(&Action{Action: req.Action, Code: -1005, Msg: "request not supported"}) - return - } + handlers := InitManager().Handlers(req.Action) + if len(handlers) == 0 { + c.SendActionMsg(&Action{Action: req.Action, Code: -1005, Msg: "request not supported"}) + return + } ctx := &Context{ Id: req.Id,