Search code examples
javagoogle-app-enginegwtchannel-api

Google App Eninge Channel API usable for broadcasting JSON-Data to multiple clients?


I was reading about the Google App Engine Channel API.

I want to know, if i can use this API to create message and send it as a broadcast to all clients who want to read it. (They are connected). What i don't understand are the caveats.

My Usecase:

  • I have a Liveticker (Soccer) and send messages.
  • All useres who are on the Live-Ticker-Page, can see my massage instantlly.
  • Score on Usere devices must be updated by incoming JSON

I don't want to use polling.

Would Google Talk/XMPP be a better alternative? Or do you have a better alternative?


Solution

  • Yes, you can.

    The caveats are:

    1. You will have to create a channel for each client, meaning that you'll have to keep their client ids somewhere and loop through them in order to send a message to each and everyone of them. You can't send one message to one global id that will be received by everyone.
    2. For each page only one channel can be created, meaning that e.g. you can't have one channel to send messages for one game's score and an other channel for another game. Both must be sent through the same channel (Though you can use an iframe for each)