ChannelDelegate

@objc public protocol ChannelDelegate: class

The channel delegate protocol defines the event methods available for a channel

  • Called when the Channel is connected

    Declaration

    Swift

    @objc optional func onConnect(_ client: ChannelClient?, error: NSError?)

    Parameters

    client

    The Client that just connected to the Channel

    error

    An error info if any

    error

    An error info if any

  • Called when the host app is ready to send or receive messages

    Declaration

    Swift

    @objc optional func onReady()
  • Called when the Channel is disconnected

    Declaration

    Swift

    @objc optional func onDisconnect(_ client: ChannelClient?, error: NSError?)

    Parameters

    client

    The Client that just disconnected from the Channel

    error

    An error info if any

    error

    An error info if any

  • Called when the Channel receives a text message

    Declaration

    Swift

    @objc optional func onMessage(_ message: Message)

    Parameters

    message

    Text message received

  • Called when the Channel receives a binary data message

    Declaration

    Swift

    @objc optional func onData(_ message: Message, payload: Data)

    Parameters

    message

    Text message received

    payload

    Binary payload data

  • Called when a client connects to the Channel

    Declaration

    Swift

    @objc optional func onClientConnect(_ client: ChannelClient)

    Parameters

    client

    The Client that just connected to the Channel

  • Called when a client disconnects from the Channel

    Declaration

    Swift

    @objc optional func onClientDisconnect(_ client: ChannelClient)

    Parameters

    client

    The Client that just disconnected from the Channel

  • Called when a Channel Error is fired

    Declaration

    Swift

    @objc optional func onError(_ error: NSError)

    Parameters

    error

    The error