自定义群组发送消息其他人收不到

hello21st

问题描述

自定义群组发送消息其他人收不到,但发送完之后服务器有日志记录,请问会是哪里的问题?

程序代码或配置

class MsgHandler_SayInClientGroup extends MsgHandlerBase{
    public function processEvent(EventProxy $proxy,$client_id,$message_data)
    {
        ...
        $new_message_json = json_encode($new_message);
        Gateway::sendToGroup($group_id ,$new_message_json);
        ChatMsgDB::getInstance()->logMsg($new_message_json, __CLASS__,__LINE__,__FUNCTION__);
    }
}
MsgHandler_SayInClientGroup::AutoRegister();

[Time:2024-11-13 16:25:02]{"chat_info":"3333#test06#8","time":1731486302,"msg_id":36,"type":"say"}[Type:ChatMsg][ErrorLevel4][Class:Chat\ChatCommon\ChatMsgDB][Function:logMsg][Line:88][IP:127.0.0.1]
[Time:2024-11-13 16:25:08]{"chat_info":"4444#test03#3","time":1731486308,"msg_id":37,"type":"say"}[Type:ChatMsg][ErrorLevel4][Class:Chat\ChatCommon\ChatMsgDB][Function:logMsg][Line:88][IP:127.0.0.1]

操作系统环境及workerman/webman等具体版本

232 2 0
2个回答

walkor 打赏

可能是其他人没加入分组,或者其他人的连接已经断开

  • hello21st 2024-11-14

    如何快速定位排查?谢谢

  • walkor 2024-11-14

    记录日志

  • hello21st 2024-11-15

    windows正常,linux会出现一方能收到,另一方收不到的情况,如用户3能收到用户8的消息,用户8收不到用户3的。刷新页面后都能看到(做了历史记录保存)

    windows 日志:
    [onMessage]--7f00000108fc00000001--{"type":"login","accid":"5","token":"0ba37cd9389027fcc8bf73683b572ae6824e7db0619621042431b79325f37ac3","time":"1731491534","version":"0.1.16"}
    [onMessage]--7f00000108fc00000001--{"type":"join_cligroup","group_id":"1079","player_id":"5"}
    [onMessage]--7f00000108fc00000001--{"type":"get_cligroup_msglist","group_id":"1079","start_msgid":0,"end_msgid":100}
    [onMessage]--7f00000108fc00000002--{"type":"login","accid":"6","token":"fa81c601f46159fa6dd3c2a1b9a81273250ecebdd73c95fc3cfa7b2f7d09d0bf","time":"1731491534","version":"0.1.16"}
    [onMessage]--7f00000108fc00000002--{"type":"join_cligroup","group_id":"1079","player_id":"6"}
    [onMessage]--7f00000108fc00000002--{"type":"get_cligroup_msglist","group_id":"1079","start_msgid":0,"end_msgid":100}
    [onMessage]--7f00000108fc00000002--{"type":"say_cligroup","group_id":"1079","chat_info":"33333#test06#6"}
    [onMessage]--7f00000108fc00000001--{"type":"say_cligroup","group_id":"1079","chat_info":"44444#test05#5"}
    [onMessage]--7f00000108fc00000002--{"type":"say_cligroup","group_id":"1079","chat_info":"555555555555#test06#6"}
    [onMessage]--7f00000108fc00000001--{"type":"say_cligroup","group_id":"1079","chat_info":"66666666666666#test05#5"}

    linux日志:
    [2024-11-15 17:16:13][7f000001090100000008][onMessage]{"type":"login","accid":"8","token":"00078b24a239a43ed6dd319a63cd53eb9aebffb8eff47901b035e83a63b552be","time":"1731491534","version":"0.1.16"}
    [2024-11-15 17:16:13][7f000001090100000008][onMessage]{"type":"join_cligroup","group_id":"1079","player_id":"8"}
    [2024-11-15 17:16:13][7f000001090100000008][onMessage]{"type":"get_cligroup_msglist","group_id":"1079","start_msgid":0,"end_msgid":100}
    [2024-11-15 17:16:32][7f00000108fd00000008][onMessage]{"type":"login","accid":"3","token":"ec36094077f4d8bd4c3598a2e107a4841a06aa0de18801e1fed660c6942557a4","time":"1731491534","version":"0.1.16"}
    [2024-11-15 17:16:32][7f00000108fd00000008][onMessage]{"type":"join_cligroup","group_id":"1079","player_id":"3"}
    [2024-11-15 17:16:32][7f00000108fd00000008][onMessage]{"type":"get_cligroup_msglist","group_id":"1079","start_msgid":0,"end_msgid":100}
    [2024-11-15 17:16:39][7f00000108fd00000008][onMessage]{"type":"say_cligroup","group_id":"1079","chat_info":"hhhhhhhhhh#test03#3"}
    [2024-11-15 17:16:46][7f000001090100000008][onMessage]{"type":"say_cligroup","group_id":"1079","chat_info":"ggggg#test06#8"}
    [2024-11-15 17:19:36][7f000001090100000008][onMessage]{"type":"say_cligroup","group_id":"1079","chat_info":"11111#test06#8"}
    [2024-11-15 17:19:40][7f00000108fd00000008][onMessage]{"type":"say_cligroup","group_id":"1079","chat_info":"3333333333#test03#3"}

小七他哥

workerman现在都4了,直接升级

×
🔝