From f64dfe2e643b891b831a9e06d032fcb1051e8054 Mon Sep 17 00:00:00 2001 From: hawklin2017 <32898629+hawklin2017@users.noreply.github.com> Date: Tue, 7 Apr 2026 20:03:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9F=B3=E8=A7=86=E9=A2=91=E9=80=9A=E8=AF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/openim-rpc-rtc.yml | 9 ++++----- go.mod | 6 ++++-- go.sum | 2 -- internal/msgtransfer/online_history_msg_handler.go | 8 ++++---- internal/rpc/rtc/signal.go | 12 ++++++++++-- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/config/openim-rpc-rtc.yml b/config/openim-rpc-rtc.yml index 5a68ac5b1..91f4dc9a6 100644 --- a/config/openim-rpc-rtc.yml +++ b/config/openim-rpc-rtc.yml @@ -17,11 +17,10 @@ prometheus: ports: [ 12400 ] liveKit: - # LiveKit server address reachable from the RTC service (internal/backend address) - # When deployed via docker-compose, use the service name 'livekit' - internalAddress: http://livekit:7880 - # LiveKit server address reachable from clients (external/public address) - # Production should use wss://livekit.example.com with TLS + # RTC 进程访问 LiveKit HTTP API(CreateRoom 等)。本机跑 openim-rpc-rtc、LiveKit 映射 7880 时用 127.0.0.1。 + # 与 livekit 容器同 Docker 网络时用 http://livekit:7880。也可用环境变量 OPENIM_LIVEKIT_INTERNAL_ADDRESS 覆盖。 + internalAddress: http://127.0.0.1:7880 + # 下发给客户端的 WebSocket(liveURL)。真机填本机局域网 IP;也可用 OPENIM_LIVEKIT_EXTERNAL_ADDRESS 覆盖。 externalAddress: ws://192.168.1.91:7880 # LiveKit API key (configured in your LiveKit server) apiKey: devkey diff --git a/go.mod b/go.mod index 057accbaf..b7c07e7a6 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,10 @@ module github.com/openimsdk/open-im-server/v3 go 1.25.0 +replace github.com/openimsdk/tools => ../tools + +replace github.com/openimsdk/protocol => ./protocol + require ( firebase.google.com/go/v4 v4.14.1 github.com/dtm-labs/rockscache v0.1.1 @@ -272,5 +276,3 @@ require ( golang.org/x/crypto v0.48.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect ) - -replace github.com/openimsdk/protocol => ./protocol diff --git a/go.sum b/go.sum index 9e6f775e7..025fedead 100644 --- a/go.sum +++ b/go.sum @@ -451,8 +451,6 @@ github.com/opencontainers/runc v1.3.3 h1:qlmBbbhu+yY0QM7jqfuat7M1H3/iXjju3VkP9lk github.com/opencontainers/runc v1.3.3/go.mod h1:D7rL72gfWxVs9cJ2/AayxB0Hlvn9g0gaF1R7uunumSI= github.com/openimsdk/gomake v0.0.17 h1:q8haP48VOH45WhJRiLj1YSBJyUFJqD8CTedH65i1YH8= github.com/openimsdk/gomake v0.0.17/go.mod h1:nnjS8yCtrPJAt1knMbyPiUwCH2gpyBzj/EZAONfUOXg= -github.com/openimsdk/tools v0.0.50-alpha.113 h1:rhLWaSJuhjgJFNVzmpChLCG7dPXS0+bte+CPI0008Us= -github.com/openimsdk/tools v0.0.50-alpha.113/go.mod h1:x9i/e+WJFW4tocy6RNJQ9NofQiP3KJ1Y576/06TqOG4= github.com/ory/dockertest/v3 v3.12.0 h1:3oV9d0sDzlSQfHtIaB5k6ghUCVMVLpAY8hwrqoCyRCw= github.com/ory/dockertest/v3 v3.12.0/go.mod h1:aKNDTva3cp8dwOWwb9cWuX84aH5akkxXRvO7KCwWVjE= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= diff --git a/internal/msgtransfer/online_history_msg_handler.go b/internal/msgtransfer/online_history_msg_handler.go index 90b9207fd..d6d8133fa 100644 --- a/internal/msgtransfer/online_history_msg_handler.go +++ b/internal/msgtransfer/online_history_msg_handler.go @@ -278,7 +278,7 @@ func (och *OnlineHistoryRedisConsumerHandler) handleMsg(ctx context.Context, key return } - log.ZDebug(ctx, "handleMsg", "BatchInsertChat2Cache", "lastSeq", lastSeq, "isNewConversation", isNewConversation, "userSeqMap", userSeqMap) + log.ZDebug(ctx, "handleMsg", "lastSeq", lastSeq, "isNewConversation", isNewConversation, "userSeqMap", userSeqMap) err = och.msgTransferDatabase.SetHasReadSeqs(ctx, conversationID, userSeqMap) if err != nil { @@ -302,7 +302,7 @@ func (och *OnlineHistoryRedisConsumerHandler) handleMsg(ctx context.Context, key log.ZWarn(ctx, "get group member ids error", err, "conversationID", conversationID) } else { - log.ZDebug(ctx, "handleMsg", "GetGroupMemberIDs", "userIDs", userIDs) + log.ZDebug(ctx, "handleMsg GetGroupMemberIDs", "conversationID", conversationID, "userIDs", userIDs) if err := och.conversationClient.CreateGroupChatConversations(ctx, msg.GroupID, userIDs); err != nil { log.ZWarn(ctx, "single chat first create conversation error", err, @@ -332,10 +332,10 @@ func (och *OnlineHistoryRedisConsumerHandler) handleMsg(ctx context.Context, key log.ZError(ctx, "Msg To MongoDB MQ error", err, "conversationID", conversationID, "storageList", storageMessageList, "lastSeq", lastSeq) } - log.ZDebug(ctx, "handleMsg", "MsgToMongoMQ", "conversationID", conversationID, "storageList", len(storageList), "lastSeq", lastSeq, "key", key) + log.ZDebug(ctx, "handleMsg to MsgToMongoMQ", "conversationID", conversationID, "storageList", len(storageList), "lastSeq", lastSeq, "key", key) och.toPushTopic(ctx, key, conversationID, storageList) - log.ZDebug(ctx, "handleMsg", "toPushTopic", "conversationID", conversationID, "storageList", len(storageList), "key", key) + log.ZDebug(ctx, "handleMsg to toPushTopic", "conversationID", conversationID, "storageList", len(storageList), "key", key) } } diff --git a/internal/rpc/rtc/signal.go b/internal/rpc/rtc/signal.go index 6c035f0d4..02d7c077f 100644 --- a/internal/rpc/rtc/signal.go +++ b/internal/rpc/rtc/signal.go @@ -47,7 +47,7 @@ func (s *rtcServer) SignalMessageAssemble(ctx context.Context, req *rtc.SignalMe ) switch payload := req.SignalReq.Payload.(type) { case *rtc.SignalReq_Invite: - log.ZDebug(ctx, "SignalMessageAssemble", "handleInvite", "payload", payload) + log.ZInfo(ctx, "SignalMessageAssemble", "payload", payload.Invite) r, err := s.handleInvite(ctx, payload.Invite, req.SignalReq) resp.Payload = &rtc.SignalResp_Invite{Invite: r} respErr = err @@ -116,6 +116,7 @@ func (s *rtcServer) handleInvite(ctx context.Context, req *rtc.SignalInviteReq, content := marshalSignalReq(signalReq) for _, inviteeID := range inv.InviteeUserIDList { + log.ZInfo(ctx, "sendSignalingNotification to invitee", "sendID", req.UserID, "recvID", inviteeID) if err := s.sendSignalingNotification(ctx, req.UserID, inviteeID, int32(constant.SingleChatType), req.OfflinePushInfo, content); err != nil { log.ZWarn(ctx, "sendSignalingNotification to invitee failed", err, "inviteeID", inviteeID) } @@ -465,8 +466,15 @@ func (s *rtcServer) sendSignalingNotification(ctx context.Context, sendID, recvI if offlinePush != nil { msgData.OfflinePushInfo = offlinePush } + _, err := s.msgClient.MsgClient.SendMsg(ctx, &pbmsg.SendMsgReq{MsgData: msgData}) - return err + if err != nil { + log.ZError(ctx, "sendSignalingNotification", err, "msgdata", msgData) + return err + } + log.ZInfo(ctx, "sendSignalingNotification", "msgData", msgData) + + return nil } // sendCustomSignalNotification sends a CustomSignalNotification (1605) to a user.