javascript 如何在没有nodejs的情况下使用javascript连接到rabbitmq

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14628115/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 22:09:40  来源:igfitidea点击:

how to connect to rabbitmq using javascript without nodejs

javascripttitaniumrabbitmqappcelerator

提问by GodFather

I'm implementing a mobile application using Titanium appcelerator.

我正在使用 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.

在这个应用程序中,我需要使用 RabbitMQ 实现聊天。我看到了很多关于如何使用 node js 连接到 rabbitmq 服务器的示例,但在我的情况下它不适用,我找不到任何 javascript 独立客户端。

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,或者是否有任何 javascript 独立客户端?

Thanks.

谢谢。

回答by Leto III

Is it the RabbitMQ Web STOMPyou 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.

是您正在寻找的RabbitMQ Web STOMP吗?使用 SockJS,即使在旧浏览器中也能正常工作,并且不需要 Node.js 或您编写的任何 Web 服务器端代码。

回答by Piyush Katariya

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

您还可以使用Web MQTT pluginRabbitMQ 和 HTML5 WebSockets。更多细节与这里的例子 https://www.rabbitmq.com/web-mqtt.html

回答by jawad abbasnia

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 )

您可以在 html 的 script 标签中使用 Socket IO,只需在主 app.js 中放置一个监听器来监听 rabbit mq 消费,然后从那里将消息发送到您想要的 html 脚本。(不要忘记在你的 html 文件中放置一个监听器来监听 app.js 发出的内容)