One Logo Pool Ball
Network · IOS API REFERENCE

NWProtocolWebSocket.Response

struct · iOS 13.0+ · SDK 27.1

struct Response

A server response to a WebSocket client's request to connect.

Members (4)

get · iOS 13.0+

subprotocol

TypeScript
get subprotocol(): (string) | null
Swift declaration
let subprotocol: String?

The subprotocol selected by the server.

get · iOS 13.0+

additionalHeaders

TypeScript
get additionalHeaders(): (Array<{ "name": string; "value": string }>) | null
Swift declaration
let additionalHeaders: [(name: String, value: String)]?

Any additional headers to include in the server's response.

init · iOS 13.0+

init

TypeScript
static init(status: NWProtocolWebSocket_Response_Status, subprotocol?: (string) | null, additionalHeaders?: (Array<{ "name": string; "value": string }>) | null): NWProtocolWebSocket_Response
Swift declaration
init(status: NWProtocolWebSocket.Response.Status, subprotocol: String?, additionalHeaders: [(name: String, value: String)]? = nil)

Create a server response to a WebSocket client's request to connect. - Parameter status: The status of the response. If the status is .accept, the server will accept the handshake and open the WebSocket connection. If the status is .reject, the server will reject the handshake and respond with the HTTP error 400 Bad Response. - Parameter subprotocol: The server's selected protocol from the client's list of proposed subprotocols. If the status of this response is .reject, this parameter is ignored. Pass nil to indicate the server did not find a suitable subprotocol, but has accepted the handshake anyways. Passing an empty string is prohibited by the WebSocket protocol. - Parameter additionHeaders: Any additional headers to include in the server's response.

get · iOS 13.0+

status

TypeScript
get status(): NWProtocolWebSocket_Response_Status
Swift declaration
let status: NWProtocolWebSocket.Response.Status

The status of the server's response.

Skipped declarations

No declarations were skipped in this snapshot.

All Network types →