freenet-router |
Subversion Repositories: |
Line No. | Rev | Author | Line |
---|---|---|---|
1 | 2 | simandl | <?php |
2 | |
||
3 | namespace Phem\Libraries\MessageBus; |
||
4 | |
||
5 | use Ratchet\WebSocket\Version\RFC6455\Message; |
||
6 | |
||
7 | /** |
||
8 | * @author Jakub PetrĹžĂlka <petrzilka@czweb.net> |
||
9 | */ |
||
10 | class ReactSocketPusher extends Pusher |
||
11 | { |
||
12 | |
||
13 | public function push($message) |
||
14 | { |
||
15 | $fp = stream_socket_client( |
||
16 | 'tcp://' . WEBSOCKET_PULLER_BIND_ADDR |
||
17 | . ':' . WEBSOCKET_PULLER_PORT, $errno, $errstr, 30); |
||
18 | if ($fp) |
||
19 | { |
||
20 | fwrite($fp, json_encode($message)); |
||
21 | fclose($fp); |
||
22 | } |
||
23 | } |
||
24 | |
||
25 | } |