WebSocketClient


PROTOCOL

WebSocketClient

Swift
1public protocol WebSocketClient: AnyObject

Protocol allowing alternative implementations of websockets beyond ApolloWebSocket.

Properties

request

Swift
1var request: URLRequest

The URLRequest used on connection.

delegate

Swift
1var delegate: WebSocketClientDelegate?

The delegate that will receive networking event updates for this websocket client.

  • Note: The WebSocketTransport will set itself as the delgate for the client. Consumers should set themselves as the delegate for the WebSocketTransport to observe events.

callbackQueue

Swift
1var callbackQueue: DispatchQueue

DispatchQueue 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.

Feedback

Edit on GitHub

Forums