# ChannelDelegate

    @objc public protocol ChannelDelegate: class

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

- `onConnect(_:error:)`

  Called when the Channel is connected

  #### Declaration

  Swift

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

  #### Parameters

  `client` | The Client that just connected to the Channel
  `error` | An error info if any

- `onReady()`

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

  #### Declaration

  Swift

      optional func onReady()

- `onDisconnect(_:error:)`

  Called when the Channel is disconnected

  #### Declaration

  Swift

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

  #### Parameters

  `client` | The Client that just disconnected from the Channel
  `error` | An error info if any

- `onMessage(_:)`

  Called when the Channel receives a text message

  #### Declaration

  Swift

      optional func onMessage(message: Message)

  #### Parameters

  `message` | Text message received

- `onData(_:payload:)`

  Called when the Channel receives a binary data message

  #### Declaration

  Swift

      optional func onData(message: Message, payload: NSData)

  #### Parameters

  `message` | Text message received
  `payload` | Binary payload data

- `onClientConnect(_:)`

  Called when a client connects to the Channel

  #### Declaration

  Swift

      optional func onClientConnect(client: ChannelClient)

  #### Parameters

  `client` | The Client that just connected to the Channel

- `onClientDisconnect(_:)`

  Called when a client disconnects from the Channel

  #### Declaration

  Swift

      optional func onClientDisconnect(client: ChannelClient)

  #### Parameters

  `client` | The Client that just disconnected from the Channel

- `onError(_:)`

  Called when a Channel Error is fired

  #### Declaration

  Swift

      optional func onError(error: NSError)

  #### Parameters

  `error` | The error

© 2016 . All rights reserved. (Last updated: 2016-10-27)

Generated by jazzy ♪♫ v0.7.2, a Realm project.