16

I'm implementing a mobile application using Titanium appcelerator.

In this app, I'll need implementing a chat using RabbitMQ. I saw a lot of examples of how to connect to RabbitMQ server using node js, but in my case it isn't applicable and I could not find any JavaScript standalone client.

I'd like know if there's a way to connect to RabbitMQ without a client, or if there are any JavaScript standalone client?

frogatto
  • 28,539
  • 11
  • 83
  • 129
GodFather
  • 3,031
  • 4
  • 25
  • 36

5 Answers5

9

Is it the RabbitMQ Web STOMP you are searching for? With SockJS it works fine even in old browsers and need no Node.js or any web-server side code written by you.

  • I did some tests using rabbit stomp plugin and the stomp js client + SocketJS and it worked fine on browsers, but the stomp client and socketjs uses some objects that are exclusive of browsers (like document and window), so I could not port it to Titanium. Thanks. – GodFather Feb 03 '13 at 13:48
  • 2
    [SockJS Client](https://github.com/sockjs/sockjs-client) uses no browser exclusive objects as I find and its server-side is already built-in in RMQ Web-STOMP Plugin. Also you can implement STOMP protocol itself with JS or use an ready one. – Le chat du rabbin Feb 05 '13 at 16:13
  • I strongly recommend web_stomp over web_mqtt as (related libraries at least) stomp is by far richer than mqtt, point exchanges, queues. As far as I found, mqtt just handle topics. – Harps Oct 20 '21 at 20:52
3

You may also make use of Web MQTT plugin for RabbitMQ and HTML5 WebSockets. More details with an exmaple here https://www.rabbitmq.com/web-mqtt.html

Piyush Katariya
  • 655
  • 8
  • 11
  • I strongly recommend web_stomp over web_mqtt as (related libraries at least) stomp is by far richer than mqtt, point exchanges, queues. As far as I found, mqtt just handle topics. – Harps Oct 20 '21 at 20:52
1

You can use Socket IO in script tag in html, just put a listener into main app.js for listening to rabbit mq consume, and then from there, emit the message to the html script that you want. ( don't forget to put a listener in your html file for listening to what is emitted from app.js )

0

I also had difficulties in implementing Rabbit MQ in React js.

But one of my friends enabled/install mqtt and websocket plugins in our Rabbit Mq server.

So now I can communicate our React js app with Rabbit MQ using simple mqtt or websocket.

I think you can do the same in React Native (by using simple mqtt or websocket).

Jabal Logian
  • 1,666
  • 4
  • 24
  • 46
0

I'd like know if there's a way to connect to RabbitMQ without a client, or if there are any JavaScript standalone client?

RabbitMQ is based on AMQP protocol, which defines how to communicate between the client and the server.

And there're various client libraries in the community(some are provided by RabbitMQ, some are developed by third-party developers), you can find the libraries in this links: https://www.rabbitmq.com/devtools.html. It includes JavaScript version as well.

For your question, in theory, you can connect to RabbitMQ server without a client library. But you need to handle the AMQP protocol stuff by yourself.

Chris Bao
  • 2,418
  • 8
  • 35
  • 62