|
|
@ -56,7 +56,7 @@ func (r *RPCServer) run() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func (r *RPCServer) OnlinePushMsg(_ context.Context, in *pbRelay.OnlinePushMsgReq) (*pbRelay.OnlinePushMsgResp, error) {
|
|
|
|
func (r *RPCServer) OnlinePushMsg(_ context.Context, in *pbRelay.OnlinePushMsgReq) (*pbRelay.OnlinePushMsgResp, error) {
|
|
|
|
log.InfoByKv("PushMsgToUser is arriving", in.OperationID, "args", in.String())
|
|
|
|
log.NewInfo(in.OperationID, "PushMsgToUser is arriving", in.String())
|
|
|
|
var resp []*pbRelay.SingleMsgToUser
|
|
|
|
var resp []*pbRelay.SingleMsgToUser
|
|
|
|
msgBytes, _ := proto.Marshal(in.MsgData)
|
|
|
|
msgBytes, _ := proto.Marshal(in.MsgData)
|
|
|
|
mReply := Resp{
|
|
|
|
mReply := Resp{
|
|
|
@ -93,7 +93,7 @@ func (r *RPCServer) OnlinePushMsg(_ context.Context, in *pbRelay.OnlinePushMsgRe
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if !tag {
|
|
|
|
if !tag {
|
|
|
|
log.NewError(in.OperationID, "push err ,no matched ws conn not in map", in.String())
|
|
|
|
log.NewDebug(in.OperationID, "push err ,no matched ws conn not in map", in.String())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return &pbRelay.OnlinePushMsgResp{
|
|
|
|
return &pbRelay.OnlinePushMsgResp{
|
|
|
|
Resp: resp,
|
|
|
|
Resp: resp,
|
|
|
@ -130,12 +130,12 @@ func (r *RPCServer) GetUsersOnlineStatus(_ context.Context, req *pbRelay.GetUser
|
|
|
|
func sendMsgToUser(conn *UserConn, bMsg []byte, in *pbRelay.OnlinePushMsgReq, RecvPlatForm, RecvID string) (ResultCode int64) {
|
|
|
|
func sendMsgToUser(conn *UserConn, bMsg []byte, in *pbRelay.OnlinePushMsgReq, RecvPlatForm, RecvID string) (ResultCode int64) {
|
|
|
|
err := ws.writeMsg(conn, websocket.BinaryMessage, bMsg)
|
|
|
|
err := ws.writeMsg(conn, websocket.BinaryMessage, bMsg)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
log.ErrorByKv("PushMsgToUser is failed By Ws", "", "Addr", conn.RemoteAddr().String(),
|
|
|
|
log.NewError(in.OperationID, "PushMsgToUser is failed By Ws", "Addr", conn.RemoteAddr().String(),
|
|
|
|
"error", err, "senderPlatform", constant.PlatformIDToName(in.MsgData.SenderPlatformID), "recvPlatform", RecvPlatForm, "args", in.String(), "recvID", RecvID)
|
|
|
|
"error", err, "senderPlatform", constant.PlatformIDToName(in.MsgData.SenderPlatformID), "recvPlatform", RecvPlatForm, "args", in.String(), "recvID", RecvID)
|
|
|
|
ResultCode = -2
|
|
|
|
ResultCode = -2
|
|
|
|
return ResultCode
|
|
|
|
return ResultCode
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
log.InfoByKv("PushMsgToUser is success By Ws", in.OperationID, "args", in.String(), "recvPlatForm", RecvPlatForm, "recvID", RecvID)
|
|
|
|
log.NewDebug(in.OperationID, "PushMsgToUser is success By Ws", "args", in.String(), "recvPlatForm", RecvPlatForm, "recvID", RecvID)
|
|
|
|
ResultCode = 0
|
|
|
|
ResultCode = 0
|
|
|
|
return ResultCode
|
|
|
|
return ResultCode
|
|
|
|
}
|
|
|
|
}
|
|
|
|