One Logo Pool Ball
Network · IOS API REFERENCE

NWProtocolWebSocket.Options

class · iOS 13.0+ · SDK 27.1

class Options

A protocol options object that allows the user to configure the WebSocket protocol for custom behavior.

Members (9)

get · iOS 13.0+

autoReplyPing

TypeScript
get autoReplyPing(): boolean
Swift declaration
var autoReplyPing: Bool { get set }

A boolean indicating whether the WebSocket protocol should automatically reply to pings. If true, ping messages will automatically be consumed by the connection instead of being delivered to the user. The default setting is false.

set · iOS 13.0+

autoReplyPing

TypeScript
set autoReplyPing(value: boolean)
Swift declaration
var autoReplyPing: Bool { get set }

A boolean indicating whether the WebSocket protocol should automatically reply to pings. If true, ping messages will automatically be consumed by the connection instead of being delivered to the user. The default setting is false.

get · iOS 13.0+

skipHandshake

TypeScript
get skipHandshake(): boolean
Swift declaration
var skipHandshake: Bool { get set }

A boolean indicating whether the WebSocket protocol should skip the opening handshake and begin framing data as soon as the underlying connection is established. The default setting is false. This option should not be set when communicating with a generic WebSocket server or client. This option allows a custom handshake (or no handshake) to be implemented below the WebSocket layer when both client and server are coordinated.

set · iOS 13.0+

skipHandshake

TypeScript
set skipHandshake(value: boolean)
Swift declaration
var skipHandshake: Bool { get set }

A boolean indicating whether the WebSocket protocol should skip the opening handshake and begin framing data as soon as the underlying connection is established. The default setting is false. This option should not be set when communicating with a generic WebSocket server or client. This option allows a custom handshake (or no handshake) to be implemented below the WebSocket layer when both client and server are coordinated.

method · iOS 13.0+

setSubprotocols

TypeScript
setSubprotocols(subprotocols: Array<string>): void
Swift declaration
func setSubprotocols(_ subprotocols: [String])

Add to the list of supported application protocols that will be presented to a WebSocket server during connection establishment. This function will only take effect on WebSocket clients. - Parameter subprotocols: An array of subprotocol strings.

get · iOS 13.0+

maximumMessageSize

TypeScript
get maximumMessageSize(): number
Swift declaration
var maximumMessageSize: Int { get set }

Set the maximum allowed message size to be received by the WebSocket connection. This does not limit the sending message size. A maximum message size of 0 means there is no receive limit. The default maximum message size is 0.

set · iOS 13.0+

maximumMessageSize

TypeScript
set maximumMessageSize(value: number)
Swift declaration
var maximumMessageSize: Int { get set }

Set the maximum allowed message size to be received by the WebSocket connection. This does not limit the sending message size. A maximum message size of 0 means there is no receive limit. The default maximum message size is 0.

method · iOS 13.0+

setAdditionalHeaders

TypeScript
setAdditionalHeaders(headers: Array<{ "name": string; "value": string }>): void
Swift declaration
func setAdditionalHeaders(_ headers: [(name: String, value: String)])

Set additional HTTP header fields to be sent by the client during the WebSocket handshake. This can be used for custom protocols and cookies. Multiple headers of the same name are not allowed, and the header will replaced by the most recently set value. This function will only take effect on WebSocket clients. - Parameter headers: An array of HTTP header names and values.

init · iOS 13.0+

init

TypeScript
static init(version?: NWProtocolWebSocket_Version): NWProtocolWebSocket_Options
Swift declaration
init(_ version: NWProtocolWebSocket.Version = .version13)

Create protocol options for the WebSocket protocol. - Parameter version: The WebSocket protocol version, which defaults to .version13

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

NWProtocolWebSocket.Options.setClientRequestHandler(_:handler:)

callback cannot propagate synchronous failure

All Network types →