Protocol
WebSocketConnection
public protocol WebSocketConnection
Defines a websocket connection.
Relationships
Types Conforming to WebSocketConnection
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
Name | Type | Description |
---|---|---|
string | String |
The |
send(data:)
func send(data: Data)
Send some Data
over the websocket.
Parameters
Name | Type | Description |
---|---|---|
data | Data |
The |
ping()
func ping()
Ping the websocket once.
disconnect(closeCode:)
func disconnect(closeCode: NWProtocolWebSocket.CloseCode)
Disconnect from the websocket.
Parameters
Name | Type | Description |
---|---|---|
closeCode | NWProtocolWebSocket.CloseCode |
The code to use when closing the websocket connection. |
delegate
var delegate: WebSocketConnectionDelegate?