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

Method pushSingleToConnect

task/rpc.go:151–172  ·  view source on GitHub ↗
(serverId string, userId int, msg []byte)

Source from the content-addressed store, hash-verified

149}
150
151func (task *Task) pushSingleToConnect(serverId string, userId int, msg []byte) {
152 logrus.Infof("pushSingleToConnect Body %s", string(msg))
153 pushMsgReq := &proto.PushMsgRequest{
154 UserId: userId,
155 Msg: proto.Msg{
156 Ver: config.MsgVersion,
157 Operation: config.OpSingleSend,
158 SeqId: tools.GetSnowflakeId(),
159 Body: msg,
160 },
161 }
162 reply := &proto.SuccessReply{}
163 connectRpc, err := RClient.GetRpcClientByServerId(serverId)
164 if err != nil {
165 logrus.Infof("get rpc client err %v", err)
166 }
167 err = connectRpc.Call(context.Background(), "PushSingleMsg", pushMsgReq, reply)
168 if err != nil {
169 logrus.Infof("pushSingleToConnect Call err %v", err)
170 }
171 logrus.Infof("reply %s", reply.Msg)
172}
173
174func (task *Task) broadcastRoomToConnect(roomId int, msg []byte) {
175 pushRoomMsgReq := &proto.PushRoomMsgRequest{

Callers 1

processSinglePushMethod · 0.95

Calls 2

GetSnowflakeIdFunction · 0.92

Tested by

no test coverage detected