JDare / ClankBundle

A Symfony2 Bundle for use with Ratchet WebSocket Server
MIT License
131 stars 31 forks source link

Implement PHP Client #37

Open rvanlaak opened 9 years ago

rvanlaak commented 9 years ago

Currently the bundle supports the Javascript client. What about also supporting the PHP Client as described in the example on http://socketo.me/docs/push

By requiring react/zmq": "0.2.*|0.3.* it will get possible to let the Symfony application directly talk with Ratchet.

    $context = new ZMQContext();
    $socket = $context->getSocket(ZMQ::SOCKET_PUSH, 'my pusher');
    $socket->connect("tcp://localhost:5555");

    $socket->send(json_encode(array('message' => 'this will be pushed to all clients'));
npinon commented 9 years ago

You can also easily do it with this client : https://github.com/bazo/wamp-client

            $client = new \WAMP\WAMPClient('http://localhost:9000');
            $client->connect();
            $client->publish('yourtopic', 'your message'));