WebSocketClient
PROTOCOL
WebSocketClient
Swift
1public protocol WebSocketClient: AnyObjectProtocol allowing alternative implementations of websockets beyond ApolloWebSocket.
Properties
request
Swift
1var request: URLRequestThe URLRequest used on connection.
delegate
Swift
1var delegate: WebSocketClientDelegate?The delegate that will receive networking event updates for this websocket client.
Note: The
WebSocketTransportwill set itself as the delgate for the client. Consumers should set themselves as the delegate for theWebSocketTransportto observe events.
callbackQueue
Swift
1var callbackQueue: DispatchQueueDispatchQueue where the websocket client should call all delegate callbacks.
Methods
connect()
Swift
1func connect()Connects to the websocket server.
Note: This should be implemented to connect the websocket on a background thread.
disconnect()
Swift
1func disconnect()Disconnects from the websocket server.
write(ping:completion:)
Swift
1func write(ping: Data, completion: (() -> Void)?)Writes ping data to the websocket.
write(string:)
Swift
1func write(string: String)Writes a string to the websocket.