Signaling

Overview

The Vonage Video API and SDKs allow you to send and receive Signals. Signals are arbitrary text or data that are sent in a session which can be sent to a specific client or all connected clients. Signals can be used to implement text chat or to trigger events in a call, such as raising a hand.

You can send Signals from the API or the Client SDKs. This guide will be focused on sending and receiving Signals with the Vonage Video Client SDKs.

This how-to will go over:

  • Sending a Signal.
  • Sending a Signal to a specific client.
  • Receiving Signals.
  • Preventing Signals from being sent during automatic reconnection.

Before you start

Before you can send and receive signals, you first need to have a client connected to a session. To learn about sessions and their role in a Vonage Video application, read the Sessions documentation.

Sending a Signal

To send a Signal, call the Signal method of the Session object with some string data. This Signal will be send to all clients connected to the session. Data is limited to 8KB per Signal.

Please check the reference for your Client SDK for all the available parameters.

Sending a Signal to a Specific Client

To send a Signal to a specific client, pass a to parameter to the signal method. The value of the to parameter should be a Connection object that corresponds to the client tou want to send the Signal to.

Receiving Signals

To start receiving Signals sent in a session, add an event listener/delegate function for Signals. When sending a Signal you can also specify a type parameter which is a String, this type is returned when you receive a Signal. In JavaScript and React Native only, you can listen for events of a specific type by registering an event listener for the signal:type event. For example, signal:foo listens for signals of type "foo".

Note that you can send Signals from your server, instead of from a client connected to the session. In this case, the from property is set to null.

Preventing Signals From Being Sent During Automatic Reconnection

Clients will attempt to automatically reconnect to a session they disconnect unexpectedly (for example, due to a drop in network connectivity). By default, any Signals you send while the client is temporarily disconnected from a session are queued and sent when (and if) it successfully reconnects.

To stop this behavior, when sending a Signal set the retryAfterReconnect parameter to false. For more information, see the Automatic Reconnection developer guide.

See also