WebSocket
open class WebSocket : WebSocketClient, WebSocketEngineDelegate, @unchecked Sendable
WebSocket客户端
-
Undocumented
Declaration
Swift
public weak var delegate: WebSocketDelegate?
-
Undocumented
Declaration
Swift
public var onEvent: (@Sendable (WebSocketEvent) -> Void)?
-
Undocumented
Declaration
Swift
public var request: URLRequest
-
Undocumented
Declaration
Swift
public var callbackQueue: DispatchQueue
-
Undocumented
Declaration
Swift
public var respondToPingWithPong: Bool { get set }
-
Undocumented
Declaration
Swift
public init(request: URLRequest, engine: WebSocketEngineProtocol)
-
Undocumented
Declaration
Swift
public convenience init(request: URLRequest, certPinner: WebSocketCertificatePinning? = WebSocketFoundationSecurity(), compressionHandler: WebSocketCompressionHandler? = nil, useCustomEngine: Bool = true)
-
Undocumented
Declaration
Swift
public func connect()
-
Undocumented
Declaration
Swift
public func disconnect(closeCode: UInt16 = WebSocketCloseCode.normal.rawValue)
-
Undocumented
Declaration
Swift
public func forceDisconnect()
-
Undocumented
Declaration
Swift
public func write(data: Data, completion: (@Sendable () -> Void)?)
-
Undocumented
Declaration
Swift
public func write(string: String, completion: (@Sendable () -> Void)?)
-
Undocumented
Declaration
Swift
public func write(stringData: Data, completion: (@Sendable () -> Void)?)
-
Undocumented
Declaration
Swift
public func write(ping: Data, completion: (@Sendable () -> Void)?)
-
Undocumented
Declaration
Swift
public func write(pong: Data, completion: (@Sendable () -> Void)?)
-
Undocumented
Declaration
Swift
public func didReceive(event: WebSocketEvent)