用于ActiveMQ + WebSockets的PHP Stomp客户端库 [英] PHP Stomp client library for ActiveMQ + WebSockets

查看:125
本文介绍了用于ActiveMQ + WebSockets的PHP Stomp客户端库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了具有WebSocket支持的ActiveMQ,并且能够使JS演示正常工作。我现在面临的问题是PHP Stomp库无法与WebSocket URI一起使用,因此当我尝试尝试时:

I've installed ActiveMQ with WebSocket support and I'm able to get the JS demo working. The issue that I'm facing right now is that the PHP Stomp library won't work with the WebSocket URI so when I try:

$stomp = new Stomp('ws://localhost:61614');

我得到:


连接失败:无效的Broker URI方案

Connection failed: Invalid Broker URI scheme

是否有关于如何通过PHP发送消息的想法?我从错误的角度看这个问题吗?我应该尝试使用常规的PHP套接字函数连接到ActiveMQ吗?

Any thoughts on how I can send messages via PHP? Am I looking at this from the wrong angle. Should I try regular PHP socket functions to connect to ActiveMQ ?

谢谢。

推荐答案

是的,从PHP您应该通过TCP连接到消息队列。在内部,这将使用PHP的套接字或流套接字,但是您应该能够正常使用STOMP库。

Yes, from PHP you should connect to the message queue over TCP. Internally this will be using PHP's sockets or stream sockets, but you should be able to simply use the STOMP library normally.

面值示例:

$stomp = new Stomp('tcp://localhost:61613');

您需要确保在ActiveMQ中启用常规STOMP。

You'll need to make sure that regular STOMP is enabled in ActiveMQ.

这篇关于用于ActiveMQ + WebSockets的PHP Stomp客户端库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆