squaremo / rabbit.js

Messaging in Node.JS made easy using RabbitMQ
Other
1.52k stars 142 forks source link

rabbit.js within AngularJS #115

Open rtubio opened 8 years ago

rtubio commented 8 years ago

Can rabbit.js be included in an Angular JS application or is it strictly restricted to be used within Node.js? I know that both the Node.js and Angular JS environments are JavaScript based, but I would like to now whether rabbit.js requires specifically to be used from within Node.js.

squaremo commented 8 years ago

rabbit.js is fairly portable code in itself (although, inevitably, written in callback/promises style); however, since it relies on amqp.node (aka amqplib), I don't think it's usable outside a Node.JS environment.

rtubio commented 8 years ago

@squaremo : I know that I made you a question in the repository for AMQP that is pretty similar to this one, but I want to explore all the possibilities.

Is there any pure JS or AngularJS library for RabbitMQ?

analytik commented 8 years ago

I don't think anyone really connects directly to RabbitMQ from a browser. What's your use case?

rtubio commented 8 years ago

@analytik : my use case is a system composed of 2 different types of clients:

I am trying to find an integrated communications system to use a single protocol for all the above mentioned 3 connections. RabbitMQ, together with Redis, Crossbar.io and gunicorn-websockets, match pretty well my requirements; however, each of them has a little drawback that I am trying to work around:

  1. RabbitMQ and Redis do not have an Angular/Javascript browser support, so I cannot directly communicate my first app (Angular JS based) with the server;
    1. crossbar.io and gunicorn-websocket: libraries available for JS and even Angular (WAMP);
  2. RabbitMQ and Redis directly integrate with Django through Celery (2/3 steps configuration process) that is really fast and efficient;
    1. crossbar.io and gunicorn-websocket: not a so-clear-integration process w/Django;
    2. there is a project/example to integrate crossbar.io w/Django through Celery, but it is not very mature yet;
  3. crossbar.io and gunicorn-websocket implement WAMP, which is the correct protocol for this application (offers RPC and PUB/SUB, both for clients ant the web);
    1. RabbitMQ offers STOMP, but you kind of have to run it as a slightly separate server on its own.

As you may have noticed, I am trying to find the most suitable option and that is why I am asking for clarifications on some of the issues above to understand correctly the actual limits of these options.

analytik commented 8 years ago

www.rethinkdb.com

Although no single technology ever will be a silver bullet, I would say that RethinkDB has the potential to simplify your stack, although maybe not exactly as you imagine. It can replace Pusher.com with its realtime push, it's a full-featured database, and to some degree it can work as PUB/SUB, although it's not trying to compete with RabbitMQ.

In the next release (1-3 months) it will add support for direct connection from browsers, although I'm not sure if they plan any library-specific support on Day 1. However, hooking up RethinkDB -> Node.js + Socket.io -> Angular + Socket.io is very easy, and can be done in an hour or two.

If you're a fan of ORMs, you can use Angular + JS-Data-Angular -> Node.js + JS-Data-RethinkDB, although that doesn't have a direct support for websockets/push, but can get you up and running with basic filtering in place.

You could also try https://github.com/mikemintz/rethinkdb-websocket-client - but I have not tried that one.

(And sorry to squaremo if this feels disrespectful to have this discussion on a rabbit.js issue.)

squaremo commented 8 years ago

(And sorry to squaremo if this feels disrespectful to have this discussion on a rabbit.js issue.)

Yeah that is a bit cheeky, but since you had the grace to apologise, I'll allow it ;)