1. 找到vendor/workerman/gateway-worker/src/BusinessWorker.php

  2. 找到 public function onGatewayMessage($connection, $data)方法

  3. 修改原来的switch判断为新的代码:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
 case GatewayProtocol::CMD_ON_CLOSE:
                unset($this->_sessionVersion[Context::$client_id]);
                if ($this->_eventOnClose) {
                    $session = [];
                    if ($data['ext_data']) {
                        $session = unserialize($data['ext_data']);
                    }
                    call_user_func($this->_eventOnClose, Context::$client_id, $session);
                }
                break;