1 | <?php |
||
11 | class EchoServer implements \Nekland\Woketo\Message\MessageHandlerInterface |
||
12 | { |
||
13 | public function onConnection(\Nekland\Woketo\Server\Connection $connection) |
||
14 | { |
||
15 | } |
||
16 | |||
17 | public function onMessage(string $data, \Nekland\Woketo\Server\Connection $connection) |
||
18 | { |
||
19 | $connection->write($data); |
||
20 | } |
||
21 | |||
22 | public function onBinary(string $data, \Nekland\Woketo\Server\Connection $connection) |
||
23 | { |
||
24 | $connection->write($data, \Nekland\Woketo\Rfc6455\Frame::OP_BINARY); |
||
25 | } |
||
26 | |||
27 | public function onError(\Nekland\Woketo\Exception\WebsocketException $e, \Nekland\Woketo\Server\Connection $connection) |
||
28 | { |
||
29 | echo '(' . get_class($e) . ') ' . $e->getMessage() . "\n"; |
||
30 | } |
||
31 | } |
||
32 | |||
38 |