RabbitMQ概念及环境搭建(五)与Web的整合
####################################
rabbitmq_web_stomp
####################################
处于试验阶段,同伙WebSocket兼容层SockJS时 Web Browser与RabbitMQ(rabbitmq-stomp)实时通讯,可用于实时的WEB应用
安装
sudo rabbitmq-plugins enable rabbitmq_web_stomp
测试
:15674/stomp
使用
<script src="https://cdn.sockjs.org/sockjs-0.3.min.js"></script>
<script src="https://www.linuxidc.com/stomp.js"></script>
<script>
var ws = new SockJS('http://127.0.0.1:15674/stomp');
var client = Stomp.over(ws);
[...]
[...]
var on_connect = function() {
console.log('connected');
};
var on_error = function() {
console.log('error');
};
client.connect('guest', 'guest', on_connect, on_error, '/');
[...]
参考: