NEWDolby Interactivity APIs are now the Communications APIs Learn More >

CommandService JavaScript Web Example

Sample implementation for JavaScript (Web) of the CommandService for multiple participants to move avatars across the screen.


Users can use arrow keys to move their avatar around the screen. Position of avatar is communicated to other users in real time utilizing Communications API's CommandService.

Features Tech Stack
  • JavaScript

Key concepts

To send a command to all participants in a session, call the send() method of the Command object.

  .send({payload: 'hello world'})
  .catch((err) => {

To receive commands send in a session, add an event listener for the 'received' event dispatched by the Command object.

VoxeetSDK.command.on('received', (participant, message) => {
  const dataParsed = JSON.parse(message);
  console.log("Command received, message:", dataParsed.payload)

Did this page help you?