Use the OpenTok signaling API to send text and data to clients connected to an OpenTok session.
Once client endpoints are connected to a session using the OpenTok client SDKs, developers may choose to send signals to connected clients from the app server, rather than between client endpoints. Unlike the moderation capabilities of the JS SDK, the only function of the REST API for moderation is to provide the option to remove a connection from a session.
This topic includes the following sections:
Send an HTTP POST to the signal
resource of a specific connection ID,
for a client connected to the session:
SESSION_ID=SOMESESSIONID
CONNECTION_ID=SOMECONNECTIONID
API_KEY=123456
# Replace with a JSON web token --
# see https://tokbox.com/developer/rest/#authentication:
JWT=jwt_token
DATA='{"type":"foo","data":"bar"}'
curl -v \
-H "Content-Type: application/json" \
-X POST \
-H "X-OPENTOK-AUTH:${JWT}" \
-d "${DATA}" \
https://api.opentok.com/v2/project/${API_KEY}/session/${SESSION_ID}/connection/${CONNECTION_ID}/signal
For both signal examples below, the request body will be used to forward both
the type
and data
fields. These correspond to the type and data parameters
passed in the client signal received handlers.
Send an HTTP POST to the signal
resource of the session:
SESSION_ID=SOMESESSIONID
API_KEY=123456
# Replace with a JSON web token --
# see https://tokbox.com/developer/rest/#authentication:
JWT=jwt_token
DATA='{"type":"foo","data":"bar"}'
curl -v \
-H "Content-Type: application/json" \
-X POST \
-H "X-OPENTOK-AUTH:${JWT}" \
-d "${DATA}" \
https://api.opentok.com/v2/project/${API_KEY}/session/${SESSION_ID}/signal