Skip to content

Commit cf0ab89

Browse files
committed
Properly close web socket channel on .connectionClose event
Web socket was never actually closed since we only send data and Opcode back to the channel. This closes the actual channel and stops the connection.
1 parent 00277d8 commit cf0ab89

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

templates/swift/Sources/WebSockets/WebSocketClient.swift.twig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,5 +408,9 @@ public class WebSocketClient {
408408
} else {
409409
channel.write(frame, promise: nil)
410410
}
411+
412+
if opcode == .connectionClose {
413+
channel.close(mode: .all, promise: nil)
414+
}
411415
}
412416
}

0 commit comments

Comments
 (0)