IntroductionBesides Ajax API, starting with version 5.4.0 onwards, you can use HTML5 WebSockets to exchange messages with the broker from your browser. HTML 5 introduced web sockets, as a standardized way to communicate asynchronously with the server from a web page. This is practically an ideal channel for implementing asynchronous messaging for web pages. Also, since JavaScript easily handles text and JSON formatted data, Stomp protocol is a natural choice for the wire protocol to be used over web sockets. This solution should bring better messaging capabilities to JavaScript clients then simple Ajax API, as implementing Stomp in JavaScript brings much more messaging-oriented API and features such as transactions, for example. ConfigurationActiveMQ comes with WebSocket transport which implements Stomp over WebSockets functionality. To configure it, you need to place something like this to your ActiveMQ configuration file <transportConnectors> <transportConnector name="websocket" uri="ws://0.0.0.0:61614"/> </transportConnectors> One thing worth noting is that web sockets (just as Ajax) implements the same origin policy, so you can access only brokers running on the same host as the web application running the client. DemoAs of version 5.6.0, an adapted demo of stomp-websocket library is integrated with ActiveMQ web demo application. Enable ws transport, start the broker and go to http://localhost:8161/demo/websocket to see it in action. ClientsMore Resources |