WebSocketKit Documentation Beta

Protocol Web​Socket​Connection

public protocol WebSocketConnection

Defines a websocket connection.

%3 WebSocketConnection WebSocketConnection WebSocket WebSocket WebSocket->WebSocketConnection

Types Conforming to Web​Socket​Connection

WebSocket

Websocket representaton

Requirements

connect()

func connect()

Connect to the websocket.

send(string:​)

func send(string: String)

Send a UTF-8 formatted String over the websocket.

Parameters

string String

The String that will be sent.

send(data:​)

func send(data: Data)

Send some Data over the websocket.

Parameters

data Data

The Data that will be sent.

ping()

func ping()

Ping the websocket once.

disconnect(close​Code:​)

func disconnect(closeCode: NWProtocolWebSocket.CloseCode)

Disconnect from the websocket.

Parameters

close​Code NWProtocol​Web​Socket.​Close​Code

The code to use when closing the websocket connection.

delegate

var delegate: WebSocketConnectionDelegate?