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 are a useful tool when building applications that need to provide instant communication and/or real-time updates.
AMQP WebSockets offers full AMQP support and enables traffic transfer over WebSockets. Using AMQP WebSockets is essential if you have a web application that needs to communicate with the RabbitMQ server directly. Another use case for AMQP WebSockets is if you are behind a firewall that blocks TCP connections over ports 5671, 5672 but allows TCP connections on port 443 (https).
Since AMQP WebSockets is implementing the entire AMQP protocol, all typical AMQP features are available.
const url = `wss://test-small-ivory-rat.rmq2.cloudamqp.com/ws/amqp`It’s important that you use the Secure WebSockets protocol(wss) and connect to the endpoint at “/ws/amqp” AMQP WebSoclet TCP relay Docker Image available at Docker Hub or by running:
const amqp = new AMQPWebSocketClient(url, "VHOST", "USERNAME", "YOUR_PASSWORD")
docker run --rm -it -p 15670:15670 cloudamqp/websocket-tcp-relay --upstream tcp://container:5672