walkor / phpsocket.io

A server side alternative implementation of socket.io in PHP based on workerman.
2.3k stars 508 forks source link

using namespaces with emitter #260

Open mrkh995 opened 3 years ago

mrkh995 commented 3 years ago

i have a php script

myserver.php :


use Workerman\Worker;
use PHPSocketIO\SocketIO;

require_once 'vendor/autoload.php';

$channel = new Channel\Server();
$io = new SocketIO(2022);

$io->on('workerStart', function()use($io){
    $io->adapter('\PHPSocketIO\ChannelAdapter');
});

$io->of('/one')->on('connection', function ($socket) use ($io) {
    // ...
});

$io->of('/two')->on('connection', function ($socket) use ($io) {
  // ...
});

Worker::runAll();
```php

i'm using an emitter php script to emit events to clients connected to /one or /two namespaces

it's working for namespace '/two' connected users ;but not for '/one'
and i get this error :
"ignore different namespace /one != /two"