WebSocketConnection
public protocol WebSocketConnection
Defines a WebSocket connection.
-
Connect to the WebSocket.
Declaration
Swift
func connect() -
Send a UTF-8 formatted
Stringover the WebSocket.Declaration
Swift
func send(string: String)Parameters
stringThe
Stringthat will be sent. -
Send some
Dataover the WebSocket.Declaration
Swift
func send(data: Data)Parameters
dataThe
Datathat will be sent. -
Start listening for messages over the WebSocket.
Declaration
Swift
func listen() -
Ping the WebSocket periodically.
Declaration
Swift
func ping(interval: TimeInterval)Parameters
intervalThe
TimeInterval(in seconds) with which to ping the server. -
Ping the WebSocket once.
Declaration
Swift
func ping() -
Disconnect from the WebSocket.
Declaration
Swift
func disconnect(closeCode: NWProtocolWebSocket.CloseCode)Parameters
closeCodeThe code to use when closing the WebSocket connection.
-
The WebSocket connection delegate.
Declaration
Swift
var delegate: WebSocketConnectionDelegate? { get set }
View on GitHub
WebSocketConnection Protocol Reference