feat: Add WebSocket transport support for AMQP 1.0 connections#78
Merged
Gsantomaggio merged 2 commits intorabbitmq:mainfrom Jan 21, 2026
Merged
feat: Add WebSocket transport support for AMQP 1.0 connections#78Gsantomaggio merged 2 commits intorabbitmq:mainfrom
Gsantomaggio merged 2 commits intorabbitmq:mainfrom
Conversation
Member
|
Thanks a lot, @vedanthnyk25. |
Contributor
Author
|
Thank you so much, @Gsantomaggio ! |
Member
|
@vedanthnyk25 Thank you. Please see: #79 |
Gsantomaggio
added a commit
that referenced
this pull request
Jan 21, 2026
This pull request adds support for the AMQP WebSocket subprotocol by including the `Sec-WebSocket-Protocol` header in WebSocket connections, and provides a complete example demonstrating AMQP 1.0 over WebSockets. **Changes:** - Added `Sec-WebSocket-Protocol: amqp` header to WebSocket connection initialization - Created a comprehensive WebSocket example with queue declaration, message publishing, and consumption - Added documentation for setting up and running the WebSocket example Complete: #78 --------- Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for connecting to RabbitMQ via WebSockets (ws:// and wss:// schemes). This is essential for environments where direct TCP access (ports 5672/5671) is restricted by firewalls, allowing connection via standard HTTP/HTTPS ports.
Changes:
transport_websocket.go: Added a net.Conn adapter that wraps gorilla/websocket connections, making them compatible with the go-amqp library.
amqp_connection.go: Updated Dial logic to detect ws/wss schemes. It automatically handles the HTTP upgrade and passes the connection to the AMQP client.
uri.go: Updated validation logic to accept ws and wss as valid schemes.
-URL Sanitization: Added logic to move User/Password from the URL to Basic Auth headers, as required by the WebSocket handshake.
Testing:
Verified against a local RabbitMQ instance using websockify proxy (simulating a production NGINX/Envoy termination).
Ran existing regression tests (make test).
If any changes are required, please let me know.
Closes #74