Commit 85fb57a
committed
fix: trigger onOpen callback in Swift WebSocket after upgrade completes
Previously, the onOpen callback was not being triggered when a WebSocket
connection was established. This was due to a lifecycle timing issue where
the MessageHandler's channelActive method was never called.
The issue occurred because:
1. HTTP channel becomes active first
2. HTTP-to-WebSocket upgrade happens
3. MessageHandler is added to the pipeline after the channel is already active
4. channelActive only fires when a handler is added to an inactive channel
The fix explicitly triggers the onOpen callback in the upgradePipelineHandler
method after successfully adding the MessageHandler to the pipeline, which is
exactly when the WebSocket connection is fully established.
This ensures the onOpen callback works correctly in all SDKs that depend on
this Swift WebSocket client, including the Apple (iOS/macOS) SDK.1 parent 5970def commit 85fb57a
File tree
1 file changed
+7
-1
lines changed- templates/swift/Sources/WebSockets
1 file changed
+7
-1
lines changedLines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
300 | | - | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
301 | 307 | | |
302 | 308 | | |
303 | 309 | | |
| |||
0 commit comments