简体   繁体   中英

how to connect to rabbitmq using javascript without nodejs

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?

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.

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

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 )

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).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM