[rabbitmq-discuss] RabbitMQ and Websockets
Miguel Morales
therevoltingx at gmail.com
Fri Nov 5 08:47:20 GMT 2010
I was thinking of how to avoid writing a JS library to have to
distribute and maintain. Granted, adding something like that would be
a bit trivial. So I guess it wouldn't be too bad.
I haven't done much work with websockets, but I like this project's
syntax: http://code.google.com/p/jquery-websocket/
Where you can setup a sort of RPC/event system while keeping the code
free of if/else.
I wouldn't want to mess with any framing or any such amqp
functionality. Just dead simple publishing/consuming and with an
optional clean RPC system.
The plugin should listen for a specific json encoded message and
distribute the message to the specified location.
The plugin should know when we are a registered consumer and deliver a
json encoded message with the message and its information.
These are just some quick thoughts on it though. It may not even need
to be a plugin, but the lower the delivery latency, the better.
On Fri, Nov 5, 2010 at 1:00 AM, Michael Bridgen <mikeb at rabbitmq.com> wrote:
>> var message = new Object(); message.command = "publish";
>> message.queue = "myqueue"; message.exchange = "myexchange";
>> message.key = "mybindkey"; message.body = "hello world";
>>
>> var message_json = JSON.stringify(message);
>>
>> var ws = new WebSocket("ws://4.2.2.2:123"); ws.send(message_json);
>>
>> Consuming:
>>
>> var subscribe = new Object(); subscribe.command = "consume";
>> subscribe.queue = ...
>>
>> ws.send(subscribe_json);
>>
>> //wait for reply from server... ws.onopen = function(event) {
>> //handle message or error here.. }
>
> How about something /really/ simple:
>
> var sock = new RabbitSocket("subscribe", "myexchange");
> sock.onMessage(function(msg) {
> ...
> });
>
> and perhaps more provocatively,
>
> var sock = new RabbitSocket("request", "myqueue");
> sock.send("question");
> sock.onMessage(function(answer) {
> ...
> });
>
> or even
>
> sock.request("question", function(answer) {
> ...
> });
>
> This is a bit more like how our STOMP adapter works (now, on
> default branch[1]), and more like the much admired ZeroMQ. I've been
> messing around with this kind of model at
> https://github.com/squaremo/rabbit.js#readme.
>
> [1] http://hg.rabbitmq.com/rabbitmq-stomp/file/0aff7391968a/DESIGN.md
>
>
> Michael.
>
>> I don't need STOMP support, the websocket plugin should just require
>> a port for communication and delegate the commands to rabbitmq.
>>
>> On Thu, Nov 4, 2010 at 10:47 AM, Christian Legnitto
>> <clegnitto at mozilla.com> wrote:
>>>
>>> On Nov 4, 2010, at 10:26 AM, Marek Majkowski wrote:
>>>
>>>> On Fri, Oct 29, 2010 at 19:55, Christian
>>>> Legnitto<clegnitto at mozilla.com> wrote:
>>>>>
>>>>> [...] Support for WebSockets
>>>>>
>>>>> * It'd be nice for there a plugin to support websockets * More
>>>>> important for Mozilla as most tools are web-based * I have set
>>>>> it up with orbitd, but it's a pain / another moving piece /
>>>>> easier to uncomment a line like
>>>>> http://activemq.apache.org/websockets.html
>>>>
>>>>
>>>> Christian,
>>>>
>>>> I'm interested in creating a websockets plugin for Rabbit.
>>>>
>>>> But I'm not really sure how you'd like to use it.
>>>>
>>>> As a thing exposed to the wild internet? Or just as another
>>>> framing for AMQP? Or as a wire protocol for STOMP? (like this
>>>> thing http://jmesnil.net/stomp-websocket/doc/)
>>>>
>>>> Or maybe you have yet another use case?
>>>>
>>>> Cheers, Marek
>>>
>>> I was thinking more like http://jmesnil.net/stomp-websocket/doc/,
>>> as that's what I have been using. Of course, the more options the
>>> merrier :-) I can't really provide erlang help, but I'm sure I can
>>> poke the WebSocket guys here at Moz to provide any assistance
>>> required on that front.
>>>
>>> Thanks, Christian _______________________________________________
>>> rabbitmq-discuss mailing list rabbitmq-discuss at lists.rabbitmq.com
>>> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>>>
>>
>>>
>>
>>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
--
~ Jeremiah:9:23-24
Android 2D MMORPG: http://developingthedream.blogspot.com/,
http://www.youtube.com/user/revoltingx
More information about the rabbitmq-discuss
mailing list