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.

Search Discussions

  • Michael Klishin at Aug 4, 2011 at 8:03 pm
    2011/8/4 sid__ <sid.ravichandran at gmail.com>
    I am unable to figure how one would go about doing this. Since they
    run on separate ports there would be the issue of violating the same
    origin policy.

    I am familiar with how Orbited provides long polling support for XMPP
    but I was unable to find something similar for AMQP. But how would the
    AMQP server respond without and explicit HTTP Request handler.

    I would really appreciate some help on how this should be implemented.
    Some sample code would be great.
    You can combined multiple EventMachine-based servers in the same process.
    You can combine em-websocket, amqp gem and something that helps you with
    long polling (it probably can be something Thin or Goliath-based).

    Also I would like to know if the general practice is to run the AMQP
    server as daemon or as part of Rails app.
    I typically recommend running amqp daemons as satellite applications but
    there are certainly cases when people run amqp daemons
    basically embedded into Web applications. Just keep in mind Ruby 1.8.7
    threading scheduler is not really fair (some threads may be given
    significantly more time to run than others) and while 1.9.2 uses kernel
    threads that are a lot better in this regard, I have seen obscure 1.9.2 VM
    crashes with multithreaded applications.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprabbitmq-discuss @
categoriesrabbitmq
postedAug 4, '11 at 7:19p
activeAug 4, '11 at 8:03p
posts2
users2
websiterabbitmq.com
irc#rabbitmq

2 users in discussion

Sid__: 1 post Michael Klishin: 1 post

People

Translate

site design / logo © 2022 Grokbase