JDare / ClankBundle

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

How to implement "Push to an Existing Site" using ZeroMQ? #13

Open ghost opened 10 years ago

ghost commented 10 years ago

I need to implement the Push to an Existing Site feature mentioned in the Ratchet documentation.

However, I found no clues on how to accomplish this functionality using Clankbundle! Could you please demonstrate (preferably with code) how would one use ZeroMQ with Clankbundle?

Other than that keep up the terrific work :+1:

kor3k commented 10 years ago

actually, you don't really need ZeroMQ. you can connect and publish directly to the Ratchet ws server from your pushing script, you only need a php ws client like this one https://github.com/gabrielbull/php-websocket-client

ghost commented 10 years ago

@kor3k Sorry, but I don't see how this could be used instead of ZeroMQ. This code looks like it's running it's own server. How is that related to sending messages between Ratchet and my scripts?

kor3k commented 10 years ago

@sherifsabry20000 not a server, a client. you can connect/publish to your ws server with it instead of zmq in your php scripts.

you only need to stop the client's loop at some point.

https://github.com/kor3k/ratchet/blob/master/src/Test/Pusher.php https://github.com/kor3k/ratchet/blob/master/web/pusher.php

peec commented 10 years ago

@sherifsabry20000 I looked for the same feature. I wanted to send a private message to the websocket server from a normal Symfony2 controller, hence e.g. if I update or add some record to the database I want to send a notification to the user via websockets. I have implemented Push system using ZeroMQ in my fork, I guess that is what you are looking for ? https://github.com/peec/ClankBundle/blob/master/Resources/docs/ZMQIntegration.md