WebSocket
Undocumented
-
Undocumented
See more
-
Responds to callback about new messages coming in over the WebSocket and also connection/disconnect messages.
Declaration
Swift
public weak var delegate: WebSocketDelegate?
-
The optional advanced delegate can be used insteadof of the delegate
Declaration
Swift
public weak var advancedDelegate: WebSocketAdvancedDelegate?
-
Receives a callback for each pong message recived.
Declaration
Swift
public weak var pongDelegate: WebSocketPongDelegate?
-
Undocumented
See more -
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Undocumented
-
Used for setting protocols.
Declaration
Swift
public init(url: URL, protocols: [String]? = nil)
-
Undocumented
-
Connect to the WebSocket server on a background thread.
Declaration
Swift
open func connect()
-
Disconnect from the server. I send a Close control frame to the server, then expect the server to respond with a Close control frame and close the socket from its end. I notify my delegate once the socket has been closed. If you supply a non-nil
forceTimeout
, I wait at most that long (in seconds) for the server to close the socket. After the timeout expires, I close the socket and notify my delegate. If you supply a zero (or negative)forceTimeout
, I immediately close the socket (without sending a Close control frame) and notify my delegate.Declaration
Swift
open func disconnect(forceTimeout: TimeInterval? = nil, closeCode: UInt16 = CloseCode.normal.rawValue)
Parameters
forceTimeout
Maximum time to wait for the server to close the socket.
closeCode
The code to send on disconnect. The default is the normal close code for cleanly disconnecting a webSocket.
-
Write a string to the websocket. This sends it as a text frame. If you supply a non-nil completion block, I will perform it when the write completes.
Declaration
Swift
open func write(string: String, completion: (() -> ())? = nil)
Parameters
string
The string to write.
completion
The (optional) completion handler.
-
Write binary data to the websocket. This sends it as a binary frame. If you supply a non-nil completion block, I will perform it when the write completes.
Declaration
Swift
open func write(data: Data, completion: (() -> ())? = nil)
Parameters
data
The data to write.
completion
The (optional) completion handler.
-
Write a ping to the websocket. This sends it as a control frame. Yodel a sound to the planet. This sends it as an astroid. http://youtu.be/Eu5ZJELRiJ8?t=42s
Declaration
Swift
open func write(ping: Data, completion: (() -> ())? = nil)
-
Delegate for the stream methods. Processes incoming bytes
Declaration
Swift
open func stream(_ aStream: Stream, handle eventCode: Stream.Event)