This commit is contained in:
as2252258@163.com
2021-07-28 01:49:52 +08:00
parent bab9f9d6f7
commit 17ea843ddf
+8 -9
View File
@@ -68,15 +68,14 @@ class HTTPServerListener extends Abstracts\Server
static::$_http->set($settings['settings'] ?? []);
static::$_http->on('request', [$reflect, 'onRequest']);
static::$_http->on('connect', [$reflect, 'onConnect']);
if (swoole_version() >= '4.7.0') {
static::$_http->on('disconnect', [$reflect, 'onDisconnect']);
$reflect->setEvents(Constant::DISCONNECT, $settings['events'][Constant::DISCONNECT] ?? null);
} else {
static::$_http->on('close', [$reflect, 'onClose']);
$reflect->setEvents(Constant::CLOSE, $settings['events'][Constant::CLOSE] ?? null);
}
$reflect->setEvents(Constant::CONNECT, $settings['events'][Constant::CONNECT] ?? null);
// if (swoole_version() >= '4.7.0') {
// static::$_http->on('disconnect', [$reflect, 'onDisconnect']);
// $reflect->setEvents(Constant::DISCONNECT, $settings['events'][Constant::DISCONNECT] ?? null);
// } else {
// static::$_http->on('close', [$reflect, 'onClose']);
// $reflect->setEvents(Constant::CLOSE, $settings['events'][Constant::CLOSE] ?? null);
// }
// $reflect->setEvents(Constant::CONNECT, $settings['events'][Constant::CONNECT] ?? null);
return static::$_http;
}