dleno / hyperf-socket-io-client
websocket-io client(PHP)
v2.1.0
2021-01-30 06:34 UTC
Requires
- php: >=7.2
- ext-swoole: >=4.5
- hyperf/utils: ~2.1.0
- psr/log: ~1.0
Requires (Dev)
- phpunit/phpunit: ^7.0.0
This package is auto-updated.
Last update: 2024-11-29 06:22:27 UTC
README
hyperf-socket-io-client
example
use Dleno\SocketIOClient\Client;
use Dleno\SocketIOClient\Engine\SocketIO\Version1;
$client = new Client(new Version1("ws://169.1.0.251:9502/?cdk=sss&room=1", [
'headers' => [
'cdk: websocket cdk',
'Authorization: Bearer 12b3c4d5e6f7g8h9i'
],
]));
$client->initialize(true);//keepAlive
$client->of('/spread');
$client->emit('event', 'hello, hyperf');
$client->emit('join-room', 'room1');
$client->emit('say', '{"room":"room1", "message":"Hello Hyperf!!!"}');
$client->close();