PHP Stomp client library for ActiveMQ + WebSockets

2019-06-12 11:22发布

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条回答
来,给爷笑一个
2楼-- · 2019-06-12 11:53

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.

查看更多
登录 后发表回答