ActiveMQ 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
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.
Secure Web Sockets
Version 5.7.0 introduced Secure Web Socket transport. To configure it you need two things. First, you need to configure a new transport connector like this
Note that we use wss url prefix to denote a secured version of the protocol. Next you need to provide SSL context for this transport. You can do that by providing sslContext in your broker configuration in a similar fashion as you’d do for ssl or https transports.
That’s it, your secure websocket transport is ready. Take a look at the next section to see how to use a demo to test it out.
To see demos:
- Start the broker with
wstransport (you can use activemq-demo.xml configuration for that)
- Go to http://localhost:8161/demo/websocket to check Stomp example
- Go to http://localhost:8161/demo/mqtt to check MQTT example