WebSocketEvents

public struct WebSocketEvents

The WebSocketEvents struct is used by the events property and manages the events for the WebSocket connection.

  • An event to be called when the WebSocket connection’s readyState changes to .Open; this indicates that the connection is ready to send and receive data.

    Declaration

    Swift

    public var open : ()->() = {}
  • An event to be called when the WebSocket connection’s readyState changes to .Closed.

    Declaration

    Swift

    public var close : (code : Int, reason : String, wasClean : Bool)->() = {(code, reason, wasClean) in}
  • An event to be called when an error occurs.

    Declaration

    Swift

    public var error : (error : ErrorType)->() = {(error) in}
  • An event to be called when a message is received from the server.

    Declaration

    Swift

    public var message : (data : Any)->() = {(data) in}
  • An event to be called when a pong is received from the server.

    Declaration

    Swift

    public var pong : (data : Any)->() = {(data) in}
  • end

    An event to be called when the WebSocket process has ended; this event is guarenteed to be called once and can be used as an alternative to the close or error events.

    Declaration

    Swift

    public var end : (code : Int, reason : String, wasClean : Bool, error : ErrorType?)->() = {(code, reason, wasClean, error) in}