WebSocketTransport.Configuration
STRUCT
WebSocketTransport.Configuration
1public struct Configuration
Properties
clientName
1public fileprivate(set) var clientName: String
The client name to use for this client. Defaults to Self.defaultClientName
clientVersion
1public fileprivate(set) var clientVersion: String
The client version to use for this client. Defaults to Self.defaultClientVersion
.
reconnect
1public let reconnect: Atomic<Bool>
Whether to auto reconnect when websocket looses connection. Defaults to true.
reconnectionInterval
1public let reconnectionInterval: TimeInterval
How long to wait before attempting to reconnect. Defaults to half a second.
allowSendingDuplicates
1public let allowSendingDuplicates: Bool
Allow sending duplicate messages. Important when reconnected. Defaults to true.
connectOnInit
1public let connectOnInit: Bool
Whether the websocket connects immediately on creation.
If false, remember to call resumeWebSocketConnection()
to connect.
Defaults to true.
connectingPayload
1public fileprivate(set) var connectingPayload: JSONEncodableDictionary?
[optional]The payload to send on connection. Defaults to an empty JSONEncodableDictionary
.
requestBodyCreator
1public let requestBodyCreator: RequestBodyCreator
The RequestBodyCreator
to use when serializing requests. Defaults to an ApolloRequestBodyCreator
.
operationMessageIdCreator
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:)
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