Channel API outside browsers

181 views
Skip to first unread message

Tomas Alaeus

unread,
Nov 2, 2010, 8:41:03 AM11/2/10
to Google App Engine
I for one thought directly of games when I heard that the Channel API
were coming to AppEngine. However, all discussions and articles only
mentions a Javascript client running in a web browser. Will it come
ports to other languages as well? Maybe the actual communication is so
simple that it is trivial to do oneself (considering that the API is
somewhat similar to websockets if I understood it correctly)?

Thanks, Tomas

Robert Kluin

unread,
Nov 3, 2010, 12:20:19 AM11/3/10
to google-a...@googlegroups.com
Have you look at the communications at all? I the javascript file is
included in the SDK. It is a little "heavy," but you could probably
use firebug (or chrome/safari dev console) to figure out what is going
on.

http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/tools/dev-channel-js.js


Robert

> --
> You received this message because you are subscribed to the Google Groups "Google App Engine" group.
> To post to this group, send email to google-a...@googlegroups.com.
> To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
>
>

Peter Petrov

unread,
Nov 3, 2010, 12:29:14 AM11/3/10
to google-a...@googlegroups.com
Forget about emulating it outside of a browser. Your best bet is using a separate mechanism for sending messages to non-browser clients - for example make a HTTP postback, or send a XMPP message.

Robert Kluin

unread,
Nov 3, 2010, 12:37:35 AM11/3/10
to google-a...@googlegroups.com
Are the data-exchanges overly complicated?

I have used XMPP for an app, I was hoping the channel API would let me simplify.

Robert

Tomas Alaeus

unread,
Nov 3, 2010, 6:02:43 AM11/3/10
to Google App Engine
I must admit, I haven't looked at the javascript in the SDK, no.
Didn't really think about it. In either case, it would be really nice
if official APIs for other languages were released as well. Maybe not
so likely to happen though.

On 3 Nov, 05:37, Robert Kluin <robert.kl...@gmail.com> wrote:
> Are the data-exchanges overly complicated?
>
> I have used XMPP for an app, I was hoping the channel API would let me simplify.
>
> Robert
>
>
>
> On Wed, Nov 3, 2010 at 00:29, Peter Petrov <onest...@gmail.com> wrote:
> > Forget about emulating it outside of a browser. Your best bet is using a
> > separate mechanism for sending messages to non-browser clients - for example
> > make a HTTP postback, or send a XMPP message.
>
> > On Wed, Nov 3, 2010 at 6:20 AM, Robert Kluin <robert.kl...@gmail.com> wrote:
>
> >> Have you look at the communications at all?  I the javascript file is
> >> included in the SDK.  It is a little "heavy," but you could probably
> >> use firebug (or chrome/safari dev console) to figure out what is going
> >> on.
>
> >>http://code.google.com/p/googleappengine/source/browse/trunk/python/g...
>
> >> Robert

Peter Petrov

unread,
Nov 3, 2010, 9:15:56 AM11/3/10
to google-a...@googlegroups.com
It will let you simplify _when_ you run inside a web browser. That's what the Channel API is designed for. For pushing data to other types of clients (automated services, bots, etc.) there already exist good solutions - XMPP, PubSubHubbub, plain HTTP POSTs.

When you run in a browser, the complexity is hidden in the Channel API javascript. Only a simplistic interface similar to WebSockets is exposed to you as developer. But the complexity hidden underneath in the Channel API client library is pretty big:

- first, there is HTTP long-polling used to emulate a persistent connection
- second, an undocumented protocol is used to frame the separate messages; it's probably ProtocolBuffers-based
- third, an invisible Iframe together with a Closure XPC channel is used to bypass the same-origin javascript policy

The last one is not necessary if you create an out-of-browser client. But the first two are complex enough (primarily the first one). Considering that you have other (good) options, it would be quite crazy to go down that road.

Tomas Alaeus

unread,
Nov 3, 2010, 12:00:57 PM11/3/10
to Google App Engine
Yes, there exist other solutions to this already. But those require
(at least to my knowledge) either a server outside AppEngine or the
use of another service. To have everything inside the AppEngine
environment would be really nice for a lot of reasons.

On 3 Nov, 14:15, Peter Petrov <onest...@gmail.com> wrote:
> It will let you simplify _when_ you run inside a web browser. That's what
> the Channel API is designed for. For pushing data to other types of clients
> (automated services, bots, etc.) there already exist good solutions - XMPP,
> PubSubHubbub, plain HTTP POSTs.
>
> When you run in a browser, the complexity is hidden in the Channel API
> javascript. Only a simplistic interface similar to WebSockets is exposed to
> you as developer. But the complexity hidden underneath in the Channel API
> client library is pretty big:
>
> - first, there is HTTP long-polling used to emulate a persistent connection
> - second, an undocumented protocol is used to frame the separate messages;
> it's probably ProtocolBuffers-based
> - third, an invisible Iframe together with a Closure XPC channel is used to
> bypass the same-origin javascript policy
>
> The last one is not necessary if you create an out-of-browser client. But
> the first two are complex enough (primarily the first one). Considering that
> you have other (good) options, it would be quite crazy to go down that road.
>
>
>
> On Wed, Nov 3, 2010 at 6:37 AM, Robert Kluin <robert.kl...@gmail.com> wrote:
> > Are the data-exchanges overly complicated?
>
> > I have used XMPP for an app, I was hoping the channel API would let me
> > simplify.
>
> > Robert
>
> > On Wed, Nov 3, 2010 at 00:29, Peter Petrov <onest...@gmail.com> wrote:
> > > Forget about emulating it outside of a browser. Your best bet is using a
> > > separate mechanism for sending messages to non-browser clients - for
> > example
> > > make a HTTP postback, or send a XMPP message.
>
> > > On Wed, Nov 3, 2010 at 6:20 AM, Robert Kluin <robert.kl...@gmail.com>
> > wrote:
>
> > >> Have you look at the communications at all?  I the javascript file is
> > >> included in the SDK.  It is a little "heavy," but you could probably
> > >> use firebug (or chrome/safari dev console) to figure out what is going
> > >> on.
>
> >http://code.google.com/p/googleappengine/source/browse/trunk/python/g...
>
> > >> Robert
>
> > >> On Tue, Nov 2, 2010 at 08:41, Tomas Alaeus <tala...@gmail.com> wrote:
> > >> > I for one thought directly of games when I heard that the Channel API
> > >> > were coming to AppEngine. However, all discussions and articles only
> > >> > mentions a Javascript client running in a web browser. Will it come
> > >> > ports to other languages as well? Maybe the actual communication is so
> > >> > simple that it is trivial to do oneself (considering that the API is
> > >> > somewhat similar to websockets if I understood it correctly)?
>
> > >> > Thanks, Tomas
>
> > >> > --
> > >> > You received this message because you are subscribed to the Google
> > >> > Groups "Google App Engine" group.
> > >> > To post to this group, send email to
> > google-a...@googlegroups.com.
> > >> > To unsubscribe from this group, send email to
> > >> > google-appengi...@googlegroups.com<google-appengine%2Bunsubscrib­e...@googlegroups.com>
> > .
> > >> > For more options, visit this group at
> > >> >http://groups.google.com/group/google-appengine?hl=en.
>
> > >> --
> > >> You received this message because you are subscribed to the Google
> > Groups
> > >> "Google App Engine" group.
> > >> To post to this group, send email to google-a...@googlegroups.com.
> > >> To unsubscribe from this group, send email to
> > >> google-appengi...@googlegroups.com<google-appengine%2Bunsubscrib­e...@googlegroups.com>
> > .
> > >> For more options, visit this group at
> > >>http://groups.google.com/group/google-appengine?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Google App Engine" group.
> > > To post to this group, send email to google-a...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > google-appengi...@googlegroups.com<google-appengine%2Bunsubscrib­e...@googlegroups.com>
> > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-appengine?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" group.
> > To post to this group, send email to google-a...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengi...@googlegroups.com<google-appengine%2Bunsubscrib­e...@googlegroups.com>
> > .

dilbert

unread,
Nov 3, 2010, 3:24:25 AM11/3/10
to Google App Engine
I think that the Channel API uses XMPP under the hood (as mentioned
here: http://www.youtube.com/watch?v=oMXe-xK0BWA at about 13:20).
I do not see why we could not have a Java or Python client library for
Channel API. There is some information about it in this thread (http://
groups.google.com/group/google-appengine-java/browse_thread/thread/
d0401a784d4171c8). Posts 9 and 10 are relevant. It would be nice if we
could use the Channel API on Android. Maybe an issue (feature request)
should be raised.

@Peter - are You saying that a Java client library to use with the
Channel API would be impractical/impossible to implement. Could You
elaborate a bit.


On Nov 3, 5:37 am, Robert Kluin <robert.kl...@gmail.com> wrote:
> Are the data-exchanges overly complicated?
>
> I have used XMPP for an app, I was hoping the channel API would let me simplify.
>
> Robert
>
> On Wed, Nov 3, 2010 at 00:29, Peter Petrov <onest...@gmail.com> wrote:
> > Forget about emulating it outside of a browser. Your best bet is using a
> > separate mechanism for sending messages to non-browser clients - for example
> > make a HTTP postback, or send a XMPP message.
>
> > On Wed, Nov 3, 2010 at 6:20 AM, Robert Kluin <robert.kl...@gmail.com> wrote:
>
> >> Have you look at the communications at all?  I the javascript file is
> >> included in the SDK.  It is a little "heavy," but you could probably
> >> use firebug (or chrome/safari dev console) to figure out what is going
> >> on.
>
> >>http://code.google.com/p/googleappengine/source/browse/trunk/python/g...
>
> >> Robert

dilbert

unread,
Nov 3, 2010, 1:19:37 PM11/3/10
to Google App Engine
Peter already answered some of the questions in my previous post. It
was posted about half a day ago but since it was my first post in this
group it got stuck in the approval process.

On Nov 3, 8:24 am, dilbert <dilbert.elbo...@gmail.com> wrote:
> I think that the Channel API uses XMPP under the hood (as mentioned
> here:http://www.youtube.com/watch?v=oMXe-xK0BWAat about 13:20).

Robert Kluin

unread,
Nov 4, 2010, 12:27:24 AM11/4/10
to google-a...@googlegroups.com
My understanding is that the Channel API uses XMPP on the back end to
'connect' to Google's internal 'comet servers.' One of the big
advantages this approach is that your app's client does not need to
know about XMPP, or be able to process the related XML messages.
Instead you can use HTPP and JSON; that _potentially_ lets you build
a simpler client.

Unfortunately, from Peter's comments it sounds like the underlying
mechanism is still complex.

Robert

dilbert

unread,
Nov 4, 2010, 4:24:20 AM11/4/10
to Google App Engine
The Java (or Python) client library could connect to the XMPP layer
directly and on the other side provide developers with an interface
similar to the interface provided to Javascript users on the browser.
This would effectively hide the XMPP and related XML messages Robert
is talking about. Of course Google would have to provide such a
library as it provides the Channel API Javascript in the browser.
Maybe this approach is not implementable but I can not see why because
I have so little information about the internal workings of the
Channel API system. I was hoping someone from Google could enlighten
us and settle once and for all if we could use the Channel API on
clients other than browsers.

On Nov 4, 5:27 am, Robert Kluin <robert.kl...@gmail.com> wrote:
> My understanding is that the Channel API uses XMPP on the back end to
> 'connect' to Google's internal 'comet servers.'  One of the big
> advantages this approach is that your app's client does not need to
> know about XMPP, or be able to process the related XML messages.
> Instead you can use HTPP and JSON;  that _potentially_ lets you build
> a simpler client.
>
> Unfortunately, from Peter's comments it sounds like the underlying
> mechanism is still complex.
>
> Robert
>
> On Wed, Nov 3, 2010 at 13:19, dilbert <dilbert.elbo...@gmail.com> wrote:
> > Peter already answered some of the questions in my previous post. It
> > was posted about half a day ago but since it was my first post in this
> > group it got stuck in the approval process.
>
> > On Nov 3, 8:24 am, dilbert <dilbert.elbo...@gmail.com> wrote:
> >> I think that the Channel API uses XMPP under the hood (as mentioned
> >> here:http://www.youtube.com/watch?v=oMXe-xK0BWAatabout 13:20).

Michael

unread,
Nov 6, 2010, 10:50:34 AM11/6/10
to Google App Engine
I'd like to have a port of Channel API for ActionScript.
If it uses XMPP under the hood, then it should be pretty
simple to emulate as there are ready to use XMPP
libraries. Maybe Google should release the underlying
protocol specification?

Currently i'm using polling from my flash app, and it
eats around 30% of my CPU quota.

dilbert

unread,
Dec 3, 2010, 3:44:33 AM12/3/10
to Google App Engine
I submitted an issue regarding the Java client library here:
http://code.google.com/p/googleappengine/issues/detail?id=4189

so if anyone is interested please star it.

Tim Meadowcroft

unread,
Dec 3, 2010, 6:40:56 AM12/3/10
to google-a...@googlegroups.com


On Wednesday, November 3, 2010 4:20:19 AM UTC, Robert Kluin wrote:
Have you look at the communications at all? I the javascript file is
included in the SDK. It is a little "heavy," but you could probably
use firebug (or chrome/safari dev console) to figure out what is going
on.

http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/tools/dev-channel-js.js


The SDK code uses a DevChannel implementation

  goog.exportSymbol("goog.appengine.Channel", goog.appengine.DevChannel);

which is NOT doing COMET or similar, it simply polls a special page (/dev) once a second or so.

But running against the real production AppEngine, /_ah/channel/jsapi returns a 302 redirect to 


That code is minified and so not so easy to examine, but I expect the Channel object implemented there does proper COMET style long queries - you could watch what happens from the browser and see what's sent back and forth, but looking at the (current) SDK may help you understand the API calls but won't show you anything about how it's implemented in production.

--
Tim

Tim Meadowcroft

unread,
Dec 3, 2010, 6:41:10 AM12/3/10
to google-a...@googlegroups.com


On Wednesday, November 3, 2010 4:20:19 AM UTC, Robert Kluin wrote:
Have you look at the communications at all? I the javascript file is
included in the SDK. It is a little "heavy," but you could probably
use firebug (or chrome/safari dev console) to figure out what is going
on.

http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/tools/dev-channel-js.js


Reply all
Reply to author
Forward
0 new messages