简体   繁体   中英

PHP Stomp client library for ActiveMQ + WebSockets

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.

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.

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