We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.8.1
Linux (AMD)
Source Code Deployment
我在项目配置了Webhooks ,配置了 离线状态下消息推送前的回调(callbackBeforeOfflinePushCommand)和 在线状态下消息推送前的回调(callbackBeforeOnlinePushCommand),然后在用户离线的时候发送消息,可以收到 callbackBeforeOfflinePushCommand的回调通知,但是在 用户在线的时候确无法收到 callbackBeforeOnlinePushCommand 的回调通知。
配置如下:
在线
离线
The text was updated successfully, but these errors were encountered:
我尝试按照日志的打印的位置阅读了一下源码,我发现了以下一段代码:
func (c *ConsumerHandler) webhookBeforeOnlinePush(ctx context.Context, before *config.BeforeConfig, userIDs []string, msg *sdkws.MsgData) error { return webhook.WithCondition(ctx, before, func(ctx context.Context) error { if datautil.Contain(msg.SendID, userIDs...) || msg.ContentType == constant.Typing { return nil } req := callbackstruct.CallbackBeforePushReq{ UserStatusBatchCallbackReq: callbackstruct.UserStatusBatchCallbackReq{ UserStatusBaseCallback: callbackstruct.UserStatusBaseCallback{ CallbackCommand: callbackstruct.CallbackBeforeOnlinePushCommand, OperationID: mcontext.GetOperationID(ctx), PlatformID: int(msg.SenderPlatformID), Platform: constant.PlatformIDToName(int(msg.SenderPlatformID)), }, UserIDList: userIDs, }, ClientMsgID: msg.ClientMsgID, SendID: msg.SendID, GroupID: msg.GroupID, ContentType: msg.ContentType, SessionType: msg.SessionType, AtUserIDs: msg.AtUserIDList, Content: GetContent(msg), } resp := &callbackstruct.CallbackBeforePushResp{} if err := c.webhookClient.SyncPost(ctx, req.GetCallbackCommand(), req, resp, before); err != nil { return err } return nil }) }
问题很可能出现在这个判断上:
if datautil.Contain(msg.SendID, userIDs...) || msg.ContentType == constant.Typing { return nil }
日志中,msg.SendID 的值为 sendID:4514183745,userIDs的值为:"userIDs" : [ 6346834060" , "4514183745"],这里判断然后return 返回了,没有继续下面的回调的逻辑了。
sendID:4514183745
我继续向上追查,看到有下面一个方法:
func (c *ConsumerHandler) handleMs2PsChat(ctx context.Context, msg []byte) { msgFromMQ := pbpush.PushMsgReq{} if err := proto.Unmarshal(msg, &msgFromMQ); err != nil { log.ZError(ctx, "push Unmarshal msg err", err, "msg", string(msg)) return } sec := msgFromMQ.MsgData.SendTime / 1000 nowSec := timeutil.GetCurrentTimestampBySecond() if nowSec-sec > 10 { prommetrics.MsgLoneTimePushCounter.Inc() log.ZWarn(ctx, "it’s been a while since the message was sent", nil, "msg", msgFromMQ.String(), "sec", sec, "nowSec", nowSec, "nowSec-sec", nowSec-sec) } var err error switch msgFromMQ.MsgData.SessionType { case constant.ReadGroupChatType: err = c.Push2Group(ctx, msgFromMQ.MsgData.GroupID, msgFromMQ.MsgData) default: var pushUserIDList []string isSenderSync := datautil.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsSenderSync) if !isSenderSync || msgFromMQ.MsgData.SendID == msgFromMQ.MsgData.RecvID { pushUserIDList = append(pushUserIDList, msgFromMQ.MsgData.RecvID) } else { pushUserIDList = append(pushUserIDList, msgFromMQ.MsgData.RecvID, msgFromMQ.MsgData.SendID) } err = c.Push2User(ctx, pushUserIDList, msgFromMQ.MsgData) } if err != nil { log.ZWarn(ctx, "push failed", err, "msg", msgFromMQ.String()) } }
pushUserIDList 这里应该是把 RecvID 和 SendID 都往数组里面塞了。
我不太清楚这里面的逻辑,离线推送里面的代码并没有这个判断。 if datautil.Contain(msg.SendID, userIDs...) || msg.ContentType == constant.Typing { return nil }
Sorry, something went wrong.
No branches or pull requests
OpenIM Server Version
3.8.1
Operating System and CPU Architecture
Linux (AMD)
Deployment Method
Source Code Deployment
Bug Description and Steps to Reproduce
我在项目配置了Webhooks ,配置了 离线状态下消息推送前的回调(callbackBeforeOfflinePushCommand)和 在线状态下消息推送前的回调(callbackBeforeOnlinePushCommand),然后在用户离线的时候发送消息,可以收到 callbackBeforeOfflinePushCommand的回调通知,但是在 用户在线的时候确无法收到 callbackBeforeOnlinePushCommand 的回调通知。
Screenshots Link
配置如下:
在线
离线
The text was updated successfully, but these errors were encountered: