Docs
Launch GraphOS Studio


EXTENSION

WebSocketTransport

extension WebSocketTransport: NetworkTransport

Methods

send(operation:cachePolicy:contextIdentifier:callbackQueue:completionHandler:)

public func send<Operation: GraphQLOperation>(
operation: Operation,
cachePolicy: CachePolicy,
contextIdentifier: UUID? = nil,
callbackQueue: DispatchQueue = .main,
completionHandler: @escaping (Result<GraphQLResult<Operation.Data>, Error>) -> Void) -> Cancellable

Parameters

NameDescription
operationThe operation to send.
cachePolicyThe 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.
callbackQueueThe queue to call back on with the results. Should default to .main.
completionHandlerA 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:)

public func websocketDidConnect(socket: WebSocketClient)

Parameters

NameDescription
socketThe WebSocketClient that sent the delegate event.

handleConnection()

public func handleConnection()

websocketDidDisconnect(socket:error:)

public func websocketDidDisconnect(socket: WebSocketClient, error: Error?)

Parameters

NameDescription
socketThe WebSocketClient that sent the delegate event.
errorAn optional error if an error occured.

websocketDidReceiveMessage(socket:text:)

public func websocketDidReceiveMessage(socket: WebSocketClient, text: String)

Parameters

NameDescription
socketThe WebSocketClient that sent the delegate event.
textThe text received from the server.

websocketDidReceiveData(socket:data:)

public func websocketDidReceiveData(socket: WebSocketClient, data: Data)

Parameters

NameDescription
socketThe WebSocketClient that sent the delegate event.
dataThe data received from the server.
Next
Introduction
Edit on GitHubEditForumsDiscord

© 2024 Apollo Graph Inc.

Privacy Policy

Company