File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Sources/ObservableWebSocketClient/Interface Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ //
2+ // ObservableWebSocketClient+Connection.swift
3+ //
4+ //
5+ // Created by Fernando Fernandes on 18.04.24.
6+ //
7+
8+ import Foundation
9+
10+ public extension ObservableWebSocketClient {
11+
12+ /// Sends a close frame with an optional close reason.
13+ ///
14+ /// - Parameter closeCode: A `URLSessionWebSocketTask.CloseCode`
15+ /// that indicates the reason for closing the connection. The default is `.normalClosure`.
16+ /// - Parameter reason: Optional further information to explain the closing.
17+ /// The value of this parameter is defined by the endpoints, not by the standard.
18+ func closeConnection( with closeCode: URLSessionWebSocketTask . CloseCode = . normalClosure,
19+ reason: String ? = nil ) {
20+ service. close ( reason: reason)
21+ }
22+ }
You can’t perform that action at this time.
0 commit comments