[rabbitmq-discuss] How to use Long Polling with RabbitMQ and Rails
sid__
sid.ravichandran at gmail.com
Thu Aug 4 20:19:08 BST 2011
I have just begun using RabbitMQ with Ruby using the amqp ruby gem. I
built a simple multiuser chat application using Rails, which manages
the user subscription, authentication and rooms etc and the AMQP
server manages the messaging. My amqp server runs as a daemon process
and the Rails application communicates with it using websockets and
TCPSockets.
Since websockets is not supported on all browsers I think Long Polling
is the only other alternative to push message to the users in a
chatroom.
I am not completely sure on how to go about doing this since my AMQP
server runs on a different port so it would violate the same origin
policy unless I use JSONP which would work only with GET requests and
it would need some kind of HTTP request handler.
I am familiar with how orbited provides long polling for XMPP servers
but I was unable to find a similar javascript library for AMQP
I would also like to know if production amqp apps have their messaging
server running separately as a daemon or are they usually run as part
of the main application.
I would appreciate some guidance on how to go about building this. My
code is available on my github profile and is available at
https://github.com/supersid/AMQP-Server-Using-Websocket-OO Please
ignore the amqp_server.rb file which is not really used and
oo_amqp_server.rb is the starting point
Thank you.
More information about the rabbitmq-discuss
mailing list