package task import ( "server/pb" "github.com/gogo/protobuf/proto" "github.com/liangdas/mqant/log" ) func U(msg []byte, resp proto.Message) bool { if err := proto.Unmarshal(msg, resp); err != nil { log.Error("%T err:%v", resp, err) return false } return true } func (w *WsWork) LoginResp(msg []byte) { resp := new(pb.LoginResponse) if !U(msg, resp) { return } log.Debug("LoginResp resp:%+v", resp) // return if resp.Result != 0 { return } // w.Wait() } func (w *WsWork) BroadcastResp(msg []byte) { resp := new(pb.BroadcastMsg) if !U(msg, resp) { return } // log.Debug("BroadcastResp resp:%+v", resp) }