A simple WebSocket client implemented in php.
This library uses PHP 5.3+.
It is recommended that you install the WebSocket client library through composer.
{
"require": {
"symbiose/websocket-client": "dev-master"
}
}
Here is an example of a simple WebSocket client:
class Client implements WebSocketClient\WebSocketClientInterface {
private $client;
public function onMessage($data) {}
public function sendData($data) {
$this->client->sendData($data);
}
public function setClient(WebSocketClient $client) {
$this->client = $client;
}
}
$loop = React\EventLoop\Factory::create();
$client = new WebSocketClient(new Client, $loop);
$loop->run();