cydrickn/SocketIO

Call to undefined method Swoole\WebSocket\Server::defer()

Closed this issue · 0 comments

Websocket is now listening in 0.0.0.0:8002
PHP Fatal error:  Uncaught Error: Call to undefined method Swoole\WebSocket\Server::defer() in /home/webapps/vendor/cydrickn/socketio/src/Server.php:203
Stack trace:
#0 [internal function]: Cydrickn\SocketIO\Server->onHandshake()
#1 {main}
  thrown in /home/webapps/vendor/cydrickn/socketio/src/Server.php on line 203
[2023-08-01 21:15:51 *13125.3]	WARNING	Channel::~Channel() (ERRNO 10003): channel is destroyed, 1 consumers will be discarded
[2023-08-01 21:15:51 *13125.3]	WARNING	Channel::~Channel() (ERRNO 10003): channel is destroyed, 1 consumers will be discarded
[2023-08-01 21:15:51 *13125.3]	ERROR	php_swoole_server_rshutdown() (ERRNO 503): Fatal error: Uncaught Error: Call to undefined method Swoole\WebSocket\Server::defer() in /home/webapps/vendor/cydrickn/socketio/src/Server.php:203
Stack trace:
#0 [internal function]: Cydrickn\SocketIO\Server->onHandshake()
#1 {main}
  thrown in /home/webapps/vendor/cydrickn/socketio/src/Server.php on line 203
[2023-08-01 21:15:51 $13117.0]	WARNING	Server::check_worker_exit_status(): worker(pid=13125, id=3) abnormal exit, status=255, signal=0
PHP Fatal error:  Uncaught Error: Call to undefined method Swoole\WebSocket\Server::defer() in /home/webapps/vendor/cydrickn/socketio/src/Server.php:203
Stack trace:
#0 [internal function]: Cydrickn\SocketIO\Server->onHandshake()
#1 {main}
  thrown in /home/webapps/vendor/cydrickn/socketio/src/Server.php on line 203
[2023-08-01 21:15:56 *13130.3]	WARNING	Channel::~Channel() (ERRNO 10003): channel is destroyed, 1 consumers will be discarded
[2023-08-01 21:15:56 *13130.3]	WARNING	Channel::~Channel() (ERRNO 10003): channel is destroyed, 1 consumers will be discarded
[2023-08-01 21:15:56 *13130.3]	ERROR	php_swoole_server_rshutdown() (ERRNO 503): Fatal error: Uncaught Error: Call to undefined method Swoole\WebSocket\Server::defer() in /home/webapps/vendor/cydrickn/socketio/src/Server.php:203
Stack trace:
#0 [internal function]: Cydrickn\SocketIO\Server->onHandshake()
#1 {main}
  thrown in /home/webapps/vendor/cydrickn/socketio/src/Server.php on line 203
[2023-08-01 21:15:57 $13117.0]	WARNING	Server::check_worker_exit_status(): worker(pid=13130, id=3) abnormal exit, status=255, signal=0

Serve file:

PHP version 8.2.x (Ubuntu/Mint/Deb)

<?php

require 'vendor/autoload.php';

use Cydrickn\SocketIO\Server;
//use Swoole;

$server = new Server([
    'host' => '0.0.0.0',
    'port' => 8002,
    'mode' => SWOOLE_PROCESS,
    'serve_http' => true,
    'settings' => [
        Swoole\Constant::OPTION_WORKER_NUM => swoole_cpu_num() * 2,
        Swoole\Constant::OPTION_ENABLE_STATIC_HANDLER => true,
        //Swoole\Constant::OPTION_DOCUMENT_ROOT => __DIR__ . '/public',
    ],
]);

$server->on('Started', function(Server $server) {
    echo "Websocket is now listening in " . $server->getHost() . ':' . $server->getPort() . PHP_EOL;
});

$server->on('connection', function(Server $server) {

});

$server->start();

HTML file:

onMounted(() => {
	const IO = io('http://localhost:8002', {
		path: '/',
		transports: ['websocket'],
	})

	IO.on('connection', (socket) => {

	})
})