|
|
@@ -37,7 +37,7 @@ $gateway->registerAddress = '127.0.0.1:1238';
|
|
|
|
|
|
|
|
|
// 心跳间隔
|
|
|
-$gateway->pingInterval = 5;
|
|
|
+$gateway->pingInterval = 20;
|
|
|
$gateway->pingNotResponseLimit = 2;
|
|
|
$gateway->pingData = '{"message_type":"ping"}';
|
|
|
|
|
|
@@ -49,16 +49,16 @@ Worker::$stdoutFile = $tmpPath . '/stdout_' . date("Y-m-d") . '.log';
|
|
|
// 当客户端连接上来时,设置连接的onWebSocketConnect,即在websocket握手时的回调
|
|
|
$gateway->onConnect = function ($connection) {
|
|
|
$connection->onWebSocketConnect = function ($connection, $http_header) {
|
|
|
- $apiToken = md5('Customer-Service' . strtotime(date('Y-m-d')) . $_SERVER['HTTP_ORIGIN']);
|
|
|
+ //$apiToken = md5(strtolower('Customer-Service' . strtotime(date('Y-m-d')) . $_SERVER['HTTP_ORIGIN']));
|
|
|
+ $apiToken = md5(strtolower('Customer-Service' . $_SERVER['HTTP_ORIGIN']));
|
|
|
//echo $apiToken."/".$_GET['apiToken'];
|
|
|
$_SESSION['userAgent'] = $_SERVER['HTTP_USER_AGENT'];
|
|
|
- $_SESSION['origin'] = $_SERVER['HTTP_ORIGIN'];
|
|
|
+ $_SESSION['origin'] = $_SERVER['HTTP_ORIGIN'];//
|
|
|
$getToken = isset($_GET['apiToken']) ? $_GET['apiToken'] : '';
|
|
|
|
|
|
-
|
|
|
if ($getToken !== $apiToken) {
|
|
|
//$connection->close();
|
|
|
- // return;
|
|
|
+ //return;
|
|
|
}
|
|
|
$_SESSION['remotip'] = $connection->getRemoteIp();
|
|
|
$_SESSION['remotport'] = $connection->getRemotePort();
|