Top of pageSkip to main content

Command Channel

The command channel is a flexible real-time service through which you can send data to other users in the current session. Commands can be sent directly to specific users or to the session as a whole. For example, to trigger:

  • Real-time reactions to live content
  • Access to settings in your app
  • State updates to a shared model such as a board game

At a high level, this functions similarly to chat messages, you provide a receiver and the command you would like to send as a string. The receiver can be a specific user, signified by ZoomVideoSDKUser, or you can leave it empty to broadcast to everyone.

Using a distinct service for commands instead of sending them through chat allows for better separation of concerns in your implementation, avoids hitting rate limits when sending chat messages and commands, and reduces the likelihood of encountering bugs.

Get an instance of the ZoomVideoSDKCmdChannel object

To use the command channel, you will first need to get an instance of the ZoomVideoSDKCmdChannel object.

let commandChannel = ZoomVideoSDK.shareInstance()?.getCmdChannel()

Wait for the session's command channel to become active

You must wait for the session’s command channel to become active, indicated by the onCommandChannelConnectResult callback.

func onCmdChannelConnectResult(_ success: Bool) {
    if (success) {
        // Command channel is ready for use

Send commands through the sendCommand method

Once the command channel has connected, you can send commands through the sendCommand method.

// Send command to a specific user
commandChannel?.sendCommand("raise_hand", receive: user)

// Send command to the whole session
commandChannel?.sendCommand("lower_all_hands", receive: nil)

Receive the onCommandReceived callback

After a command is sent, any SDK instance receiving the command should see the onCommandReceived callback.

func onCommandReceived(_ commandContent: String?, send sendUser: ZoomVideoSDKUser?) {
    // Respond to the command here

Need help?

If you're looking for help, try Developer Support or our Developer Forum. Priority support is also available with Premier Developer Support plans.