From 306087f71045f51f763b9b7b8b119fa82fc401ae Mon Sep 17 00:00:00 2001 From: Gordon <46924906+FGadvancer@users.noreply.github.com> Date: Fri, 8 Dec 2023 17:52:40 +0800 Subject: [PATCH] fix: online notifications do not push to herself. --- internal/msggateway/message_handler.go | 35 +++++++++++++------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/internal/msggateway/message_handler.go b/internal/msggateway/message_handler.go index 7c50866fbf..df09f4e81b 100644 --- a/internal/msggateway/message_handler.go +++ b/internal/msggateway/message_handler.go @@ -16,6 +16,7 @@ package msggateway import ( "context" + "github.com/OpenIMSDK/protocol/msg" "sync" "github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics" @@ -139,23 +140,23 @@ func (g GrpcHandler) GetSeq(context context.Context, data *Req) ([]byte, error) func (g GrpcHandler) SendMessage(context context.Context, data *Req) ([]byte, error) { prommetrics.GateWaySendMsgTotalCounter.Inc() //log.ZWarn(context, "SendMessage for statistic", nil, "operationID", data.OperationID) - //msgData := sdkws.MsgData{} - //if err := proto.Unmarshal(data.Data, &msgData); err != nil { - // return nil, err - //} - //if err := g.validate.Struct(&msgData); err != nil { - // return nil, err - //} - //req := msg.SendMsgReq{MsgData: &msgData} - //resp, err := g.msgRpcClient.SendMsg(context, &req) - //if err != nil { - // return nil, err - //} - //c, err := proto.Marshal(resp) - //if err != nil { - // return nil, err - //} - return nil, nil + msgData := sdkws.MsgData{} + if err := proto.Unmarshal(data.Data, &msgData); err != nil { + return nil, err + } + if err := g.validate.Struct(&msgData); err != nil { + return nil, err + } + req := msg.SendMsgReq{MsgData: &msgData} + resp, err := g.msgRpcClient.SendMsg(context, &req) + if err != nil { + return nil, err + } + c, err := proto.Marshal(resp) + if err != nil { + return nil, err + } + return c, nil } func (g GrpcHandler) SendSignalMessage(context context.Context, data *Req) ([]byte, error) {