WebSocketTransport.Configuration


STRUCT

WebSocketTransport.Configuration

Swift
1public struct Configuration

Properties

clientName

Swift
1public fileprivate(set) var clientName: String

The client name to use for this client. Defaults to Self.defaultClientName

clientVersion

Swift
1public fileprivate(set) var clientVersion: String

The client version to use for this client. Defaults to Self.defaultClientVersion.

reconnect

Swift
1public let reconnect: Atomic<Bool>

Whether to auto reconnect when websocket looses connection. Defaults to true.

reconnectionInterval

Swift
1public let reconnectionInterval: TimeInterval

How long to wait before attempting to reconnect. Defaults to half a second.

allowSendingDuplicates

Swift
1public let allowSendingDuplicates: Bool

Allow sending duplicate messages. Important when reconnected. Defaults to true.

connectOnInit

Swift
1public let connectOnInit: Bool

Whether the websocket connects immediately on creation. If false, remember to call resumeWebSocketConnection() to connect. Defaults to true.

connectingPayload

Swift
1public fileprivate(set) var connectingPayload: JSONEncodableDictionary?

[optional]The payload to send on connection. Defaults to an empty JSONEncodableDictionary.

requestBodyCreator

Swift
1public let requestBodyCreator: RequestBodyCreator

The RequestBodyCreator to use when serializing requests. Defaults to an ApolloRequestBodyCreator.

operationMessageIdCreator

Swift
1public let operationMessageIdCreator: OperationMessageIdCreator

The OperationMessageIdCreator used to generate a unique message identifier per request. Defaults to ApolloSequencedOperationMessageIdCreator.

Methods

init(clientName:clientVersion:reconnect:reconnectionInterval:allowSendingDuplicates:connectOnInit:connectingPayload:requestBodyCreator:operationMessageIdCreator:)

Swift
1public init(
2  clientName: String = WebSocketTransport.defaultClientName,
3  clientVersion: String = WebSocketTransport.defaultClientVersion,
4  reconnect: Bool = true,
5  reconnectionInterval: TimeInterval = 0.5,
6  allowSendingDuplicates: Bool = true,
7  connectOnInit: Bool = true,
8  connectingPayload: JSONEncodableDictionary? = [:],
9  requestBodyCreator: RequestBodyCreator = ApolloRequestBodyCreator(),
10  operationMessageIdCreator: OperationMessageIdCreator = ApolloSequencedOperationMessageIdCreator()
11)

The designated initializer

Feedback

Edit on GitHub

Forums