-
Notifications
You must be signed in to change notification settings - Fork 0
Add WebSocket and encrypted connections #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #21 +/- ##
==========================================
- Coverage 90.04% 88.53% -1.51%
==========================================
Files 25 28 +3
Lines 1998 2503 +505
==========================================
+ Hits 1799 2216 +417
- Misses 199 287 +88 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds WebSocket and TLS/encrypted connection support to STOMPNIO, resolving issues #4 and #5. The implementation includes custom WebSocket channel handlers, TLS configuration for both NIOSSL and NIO Transport Services, and comprehensive test coverage for WebSocket connections.
Key Changes
- Added WebSocket support with custom channel handlers for frame handling and HTTP upgrade negotiation
- Implemented TLS configuration supporting both NIOSSL (macOS/Linux) and NIO Transport Services (iOS/tvOS/watchOS)
- Extended test suite to validate WebSocket connections with parameterized tests across different configurations
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| Sources/STOMPNIO/WebSockets/STOMPWebSocketInitialRequestChannelHandler.swift | New handler for WebSocket HTTP upgrade handshake with STOMP protocol negotiation |
| Sources/STOMPNIO/WebSockets/STOMPWebSocketChannelHandler.swift | New duplex handler for WebSocket frame encoding/decoding and connection management |
| Sources/STOMPNIO/Connection/TSTLSConfiguration.swift | New TLS configuration for NIO Transport Services (adapted from MQTTNIO) |
| Sources/STOMPNIO/Connection/STOMPConnectionConfiguration.swift | Added TLS and WebSocket configuration structures with initialization and documentation |
| Sources/STOMPNIO/Connection/STOMPConnectionConfiguration+ConfigReader.swift | Extended config reader to support WebSocket parameters and HTTP headers |
| Sources/STOMPNIO/Connection/STOMPConnection.swift | Refactored bootstrap creation to support TLS and WebSocket with platform-specific handling |
| Sources/STOMPNIO/STOMPClientError.swift | Added new error cases for TLS misconfiguration and WebSocket upgrade failures |
| Sources/STOMPNIO/Utils/StringProtocol+trimmingWhitespace.swift | Refactored to work on StringProtocol instead of concrete String/Substring types |
| Tests/STOMPNIOTests/STOMPNIOTests.swift | Added WebSocket initial request handler tests and updated StringProtocol tests |
| Tests/STOMPNIOTests/STOMPConnectionTests.swift | Parameterized existing tests to run with both TCP and WebSocket connections |
| Package.swift | Added swift-nio-ssl, NIOWebSocket, and NIOHTTP1 dependencies |
| README.md | Updated feature list to reflect TLS and WebSocket support |
| Notice.txt | Added attribution for WebSocket and TLS code derived from MQTTNIO |
| RabbitMQ/enabled_plugins | Enabled rabbitmq_web_stomp plugin for WebSocket testing |
| .github/workflows/ci.yml | Updated CI workflow to enable WebSocket plugin in RabbitMQ |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sources/STOMPNIO/Connection/STOMPConnectionConfiguration+ConfigReader.swift
Outdated
Show resolved
Hide resolved
| case timeout | ||
| /// You have provided the wrong TLS configuration for the EventLoopGroup you provided | ||
| case wrongTLSConfig | ||
| case websocketUpgradeFailed |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error case websocketUpgradeFailed lacks documentation. All other error cases in this enum have documentation comments explaining their purpose. Consider adding a doc comment like "/// WebSocket upgrade failed during connection establishment".
| public static let timeout = Self(.timeout) | ||
| /// You have provided the wrong TLS configuration for the EventLoopGroup you provided | ||
| public static let wrongTLSConfig = Self(.wrongTLSConfig) | ||
| public static let websocketUpgradeFailed = Self(.websocketUpgradeFailed) |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error case websocketUpgradeFailed lacks documentation. All other error cases in this section have documentation comments. Consider adding a doc comment like "/// WebSocket upgrade failed during connection establishment".
| /// You have provided the wrong TLS configuration for the EventLoopGroup you provided | ||
| public static let wrongTLSConfig = Self(errorType: .wrongTLSConfig) | ||
|
|
||
| public static let websocketUpgradeFailed = Self(errorType: .websocketUpgradeFailed) |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error case websocketUpgradeFailed lacks documentation. All other error cases in this section have documentation comments. Consider adding a doc comment like "/// WebSocket upgrade failed during connection establishment".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 27 out of 29 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// Connection closed because it timed out while waiting for RECEIPT or CONNECTED frame | ||
| public static let timeout = Self(.timeout) | ||
| /// You have provided the wrong TLS configuration for the EventLoopGroup you provided | ||
| public static let wrongTLSConfig = Self(.wrongTLSConfig) |
Copilot
AI
Jan 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The websocketUpgradeFailed static property is missing documentation comments. All other static properties in this file have documentation comments. Please add a documentation comment for consistency.
| public static let wrongTLSConfig = Self(.wrongTLSConfig) | |
| public static let wrongTLSConfig = Self(.wrongTLSConfig) | |
| /// The WebSocket upgrade handshake failed |
Resolves #4, resolves #5