This commit is contained in:
2020-11-01 04:46:16 +08:00
parent 18287a60a8
commit c9fc54302c
+4 -3
View File
@@ -361,12 +361,13 @@ class Server extends Application
];
if ($config['type'] == self::TCP) {
$class['class'] = OnReceive::class;
$callback = Snowflake::createObject($class);
$this->onBind($newListener, 'receive', [$callback, 'onHandler']);
} else {
$class['class'] = OnPacket::class;
$callback = Snowflake::createObject($class);
$this->onBind($newListener, 'packet', [$callback, 'onHandler']);
}
$callback = Snowflake::createObject($class);
$this->onBind($newListener, 'packet', [$callback, 'onHandler']);
$this->onBind($newListener, 'receive', [$callback, 'onHandler']);
} else if ($config['type'] == self::WEBSOCKET) {
throw new Exception('Base server must instanceof \Swoole\Websocket\Server::class.');
} else {