CloudAMQP releases AMQP Websockets

By popular demand, CloudAMQP is announcing the release of AMQP WebSockets. Read more about this built-in feature that allows you to communicate between RabbitMQ servers or clusters directly from a web browser.

Created by CloudAMQP, AMQP WebSockets aim to simplify and facilitate communication between web clients and RabbitMQ while maintaining all the features of AMQP. This means that you no longer have to resort to WebSTOMP or WebMQTT. Best of all, AMQP WebSockets comes out of the box for all new dedicated instances on CloudAMQP.

What is WebSockets?

WebSockets is a way to send real-time data between a client (such as a web browser) and a server, allowing for highly interactive user experiences with data stored or computed on a server. WebSockets is a useful tool when building applications that need to provide instant communication and/or real-time updates.

Why use WebSockets with RabbitMQ?

Some applications require RabbitMQ to have direct communication with a web browser. For example, a chat function or similar application where communication or updates need to be instant. Unfortunately, web browsers are not compatible with AMQP connections, but this is where the "AMQP WebSockets TCP relay" comes in to bridge the gap between the browser and RabbitMQ.

The AMQP WebSockets TCP Relay for RabbitMQ

Using WebSockets with RabbitMQ is a well-known combination, usually through the use of WebSTOMP or WebMQTT. However, the new AMQP WebSockets comes with several benefits.

Running on CloudAMQP - out of the box

For new CloudAMQP dedicated instances, AMQP Websocket is automatically installed by default and does not require additional installation or plugins.

Running AMQP Websocket on your own server

If you want to run it on your own server check out https://github.com/cloudamqp/websocket-tcp-relay to learn more.

If you prefer Docker, you can find a "AMQP WebSocket TCP relay" image at Docker Hub:

docker run --rm -it -p 15670:15670 cloudamqp/websocket-tcp-relay --upstream tcp://container:5672

NOTE: When connecting to CloudAMQP via AMQP WebSockets, you should use a connection URL like: const url = `wss://test-small-ivory-rat.rmq2.cloudamqp.com/ws/amqp`
const amqp = new AMQPWebSocketClient(url, "VHOST", "USERNAME", "YOUR_PASSWORD")

It’s important that you use the Secure WebSockets protocol(wss) and connect to the endpoint at “/ws/amqp”

Shipped with a javascript client and full AMQP support

The Javascript client makes it easy to connect to the WebSocket in NodeJS or a web browser. Visit https://github.com/cloudamqp/amqp-client.js for more information and code samples.

Benefits over other alternatives

The main differences between WebSTOMP, WebMQTT, and AMQP WebSockets lies within the core differences between STOMP, MQTT, and AMQP. WebMQTT and WebSTOMP don’t have the same support for complex routing, exchanges, etc. while AMQP WebSockets speaks the language of RabbitMQ by default.

AMQP WebSockets offers full support and enables traffic transfer using AMQP (the default protocol for RabbitMQ). This way all typical AMQP features are available without having to resort to WebSTOMP or WebMQTT.

[External] Learn more about the differences between AMQP vs. MQTT vs. STOMP.

We hope you enjoyed reading about our new feature. If you have any questions or comments about AMQP WebSockets, please contact us at contact@cloudamqp.com

All the best, CloudAMQP team

CloudAMQP - industry leading RabbitMQ as a service

Start your managed cluster today. CloudAMQP is 100% free to try.

13,000+ users including these smart companies