MCPcopy Create free account
hub / github.com/LockGit/gochat / Push

Method Push

task/push.go:45–65  ·  view source on GitHub ↗
(msg string)

Source from the content-addressed store, hash-verified

43}
44
45func (task *Task) Push(msg string) {
46 m := &proto.RedisMsg{}
47 if err := json.Unmarshal([]byte(msg), m); err != nil {
48 logrus.Infof(" json.Unmarshal err:%v ", err)
49 }
50 logrus.Infof("push msg info %d,op is:%d", m.RoomId, m.Op)
51 switch m.Op {
52 case config.OpSingleSend:
53 pushChannel[rand.Int()%config.Conf.Task.TaskBase.PushChan] <- &PushParams{
54 ServerId: m.ServerId,
55 UserId: m.UserId,
56 Msg: m.Msg,
57 }
58 case config.OpRoomSend:
59 task.broadcastRoomToConnect(m.RoomId, m.Msg)
60 case config.OpRoomCountSend:
61 task.broadcastRoomCountToConnect(m.RoomId, m.Count)
62 case config.OpRoomInfoSend:
63 task.broadcastRoomInfoToConnect(m.RoomId, m.RoomUserInfo)
64 }
65}

Callers 1

InitQueueRedisClientMethod · 0.95

Tested by

no test coverage detected