WebSocketResource
public class WebSocketResource : WebSocketDelegate
Manage a websocket, reporting dis/connection, routing incoming requests to handlers, and sending websocket requests on demand
-
Construct with a url
String
and an optionalWSRequestHandler
(falls back to our default handler that rejects all requests)Declaration
Swift
public init(signalClient: SignalClient, requestHandler: WSRequestHandler? = nil)
-
connect with our Atlas-designated Signal server using our pre-negotiated credentials
Declaration
Swift
public func connect(url: String)
-
broadcast notification of connecting
Declaration
Swift
public func websocketDidConnect(socket: WebSocketClient)
-
broadcast notification of a disconnect
Declaration
Swift
public func websocketDidDisconnect(socket: WebSocketClient, error: Error?)
-
absorb receiving a text message
Declaration
Swift
public func websocketDidReceiveMessage(socket: WebSocketClient, text: String)
-
handle incoming data (responses to outgoing requests, routing to a requestHandler on incoming requests)
Declaration
Swift
public func websocketDidReceiveData(socket: WebSocketClient, data: Data)
-
disconnect the socket and free its resources
Declaration
Swift
public func disconnect()