[rabbitmq-discuss] RabbitMQ and Websockets
Michael Bridgen
mikeb at rabbitmq.com
Fri Nov 5 08:00:19 GMT 2010
> 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
>>
>
>>
>
>
More information about the rabbitmq-discuss
mailing list