Docs
Launch GraphOS Studio
You're viewing documentation for a previous version of this software. Switch to the latest stable version.


PROTOCOL

WebSocketClient

public protocol WebSocketClient: AnyObject

Protocol allowing alternative implementations of websockets beyond ApolloWebSocket.

Properties

request

var request: URLRequest

The URLRequest used on connection.

delegate

var 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

var callbackQueue: DispatchQueue

DispatchQueue where the websocket client should call all delegate callbacks.

Methods

connect()

func connect()

Connects to the websocket server.

  • Note: This should be implemented to connect the websocket on a background thread.

disconnect()

func disconnect()

Disconnects from the websocket server.

write(ping:completion:)

func write(ping: Data, completion: (() -> Void)?)

Writes ping data to the websocket.

write(string:)

func write(string: String)

Writes a string to the websocket.

Next
Introduction
Edit on GitHubEditForumsDiscord

© 2024 Apollo Graph Inc.

Privacy Policy

Company