Adding Signaling to OpenTok – Enabling Application-Level Messaging

Signaling - Melih's postToday, we’re really pleased to be introducing application-level signaling for our WebRTC implementation of OpenTok across both Web and iOS platforms.

Over the last two years, OpenTok has continued to break ground as a live video platform.

As we’ve watched use cases evolve from basic social chat all the way up to supporting complex customer support calls, we’ve also discovered that partners need more than just live video communications – they need a way to orchestrate and communicate between the application endpoints.  So today, we are exposing our signaling layer to OpenTok 2.0 developers so that you can piggyback on the distributed, scaled infrastructure that’s been proven to work over the last two years.Developers can now, without a third party library, build text chat, send game moves, move a robot, coordinate moving audience members on and off stage, and much more. You can use the Signaling API to broadcast to your entire session, or to target a message at a specific connection. This way, if you’re playing a game of Diplomacy, you can be sure that no one else is getting the secret moves you’re passing on to Italy.

Our Signaling API is built on the infrastructure that’s been powering the OpenTok event model for the last two years.  So we know it’s both flexible and robust, and we think that signaling is going to make it a lot easier for you to build much more interesting applications on the OpenTok 2.0 platform.

To get started with the new Signaling API, head over to the documentation section of your favorite client library to see the method signatures:

We also have HowTo’s to get you started, and of course our forums and IRC channels if you need any more help.

So take the Signaling API for a spin, and let us know how you are going to use it. And while you’re at it, let us know what else you’d love to see added to make it more useful to you – in the comments below.

Read more about our Signaling release:  WebRTC and Signaling: What Two Years Has Taught Us

  • FrancoisCarrillo

    I just tried your javascript API for signaling and I have a major difficulty. To can send a signal you need to know the connection of the recipient.

    My connection is session.connection OK.

    But how to get the connection of another person who is connected to this session. Your API don’t provide a way (variable or function) to get list of active connections associated to the current session?

    As I did not find the way to get the list of connections then I tried the following:
    session.addEventListener(“connectionCreated”, connectionCreatedHandler);
    event.connections.length is always = 1

    and event.connections[0] is always the connection created
    No way to create myself a list because you do not pass the others connection created.

    What I missing????

    • http://aoberoi.me Ankur Oberoi

      Hey Francois,

      Thanks for the question, I’ll try to help clarify. We don’t have an API for you to retrieve the list of connections for later querying, but using the ‘connectionCreated’ event handler you can construct a hash and query it pretty easily. You can also add connection_data when you generate a token for a specific client.

      var connections = {};
      session.addEventListener(‘connectionCreated’, function(e) {
      e.connections.forEach(function(aConnection) {
      connections[aConnection.connectionId] = aConnection;
      });
      });
      session.addEventListener(‘connectionDestroyed’, function(e) {
      e.connections.forEach(function(aConnection) {
      delete connections[aConnection.connectionId];
      });
      });

      // Find a connection by its connection_data (uses underscorejs)
      function getConnection(data) {
      return _.find(connections, function(connection) {
      return (connection.data == data);
      });
      }

      • FrancoisCarrillo

        Thanks!