Search code examples
androidjsonchromecastgoogle-cast

When sending & receiving JSON messages in the Receiver app, where does the sender ID come from?


In the Tic Tac Toe receiver example on GitHub, the onMessage(event) function uses event.senderId.

onMessage: function(event) {
      var message = event.data;
      var senderId = event.senderId;
      ...
}

Where is this value created? How do senderIds differ, when multiple sender apps are connected?

Also, when I send a message to the receiver app (via chrome or android), do I need to manually append and assign the senderId, or does the API do it automatically?

I'm confused, because I don't see the senderId variable assigned anywhere, or even used in the sender applications. Could someone clarify on it's usage and importance?


Solution

  • SDK/Framework creates a unique sender id, you do not need to create it.