WebSocketTransport
EXTENSION
WebSocketTransport
Swift
1extension WebSocketTransport: NetworkTransportMethods
send(operation:cachePolicy:contextIdentifier:callbackQueue:completionHandler:)
Swift
1public func send<Operation: GraphQLOperation>(
2 operation: Operation,
3 cachePolicy: CachePolicy,
4 contextIdentifier: UUID? = nil,
5 callbackQueue: DispatchQueue = .main,
6 completionHandler: @escaping (Result<GraphQLResult<Operation.Data>, Error>) -> Void) -> CancellableParameters
| Name | Description |
|---|---|
| operation | The operation to send. |
| cachePolicy | The CachePolicy to use making this request. |
| contextIdentifier | [optional] A unique identifier for this request, to help with deduping cache hits for watchers. Defaults to nil. |
| callbackQueue | The queue to call back on with the results. Should default to .main. |
| completionHandler | A closure to call when a request completes. On success will contain the response received from the server. On failure will contain the error which occurred. |
websocketDidConnect(socket:)
Swift
1public func websocketDidConnect(socket: WebSocketClient)Parameters
| Name | Description |
|---|---|
| socket | The WebSocketClient that sent the delegate event. |
handleConnection()
Swift
1public func handleConnection()websocketDidDisconnect(socket:error:)
Swift
1public func websocketDidDisconnect(socket: WebSocketClient, error: Error?)Parameters
| Name | Description |
|---|---|
| socket | The WebSocketClient that sent the delegate event. |
| error | An optional error if an error occured. |
websocketDidReceiveMessage(socket:text:)
Swift
1public func websocketDidReceiveMessage(socket: WebSocketClient, text: String)Parameters
| Name | Description |
|---|---|
| socket | The WebSocketClient that sent the delegate event. |
| text | The text received from the server. |
websocketDidReceiveData(socket:data:)
Swift
1public func websocketDidReceiveData(socket: WebSocketClient, data: Data)Parameters
| Name | Description |
|---|---|
| socket | The WebSocketClient that sent the delegate event. |
| data | The data received from the server. |