PHP Stomp client library for ActiveMQ + WebSockets

99封情书 提交于 2019-12-08 10:28:09

问题


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');

I get:

Connection failed: Invalid Broker URI scheme

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 ?

Thanks.


回答1:


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.

Par exemple:

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

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



来源:https://stackoverflow.com/questions/12844654/php-stomp-client-library-for-activemq-websockets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!