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.
Advertisement
Answer
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.