Consuming Google Channel API in C#
Asked Answered
H

2

7

The official documentation doesn't mention the support, but I'm wondering if it is possible to hook up a client program instead of javascript to use the Channel API. I'm currently using the basic polling technique from a windows app, having the Channel API would improve responsiveness and reduce load quite a bit.

I suppose as a ugly hack, I could render a hidden webbrowser object in the background and have javascript running in that, then feed off of that. Is there a better solution?

Hone answered 5/12, 2010 at 3:28 Comment(0)
B
10

Using XMPP won't work, because the Channel API only talks XMPP between Google servers: the XMPP traffic isn't exposed to the browser (you can verify this by using FireBug or the Chrome Developer Window to look at the contents of the "bind" requests; you'll see there's JSON being sent down).

As you said, the only viable current solution would be to wrap a browser control running just enough javascript to connect to the channel in your app, and use it to signal your C# app when it gets messages. Clunky, but workable.

While you could also reverse-engineer and then simulate what the iframe is doing and directly consume the JSON messages, your app could be broken in myriad ways as implementation details change -- and they will.

All this said, I am curious about how many people would like a native C# library, and what sorts of apps you want to write with it. WP7 apps? Windows client apps? Server apps? I've created a feature request for App Engine here:

http://code.google.com/p/googleappengine/issues/detail?id=4206

Please upvote it if you're interested, and the more details/compelling use cases you can name, the better.

Thanks!

Brettbretz answered 5/12, 2010 at 5:16 Comment(5)
I'd upvote you if I could, but my 5 measly reputation points wont let me. I've however gold star'd the issue on the appengine issue tracker.Hone
@Moshie, I was suggesting to directly use XMPP as opposed to the Channel API -- if it was feasible for his application. People would be interested in knowing the general API to interact with the Channel API. That way we can have native libraries for other languages too. There was a discussion about this in the groups not long ago.Purely
Very good point: you could skip the Channel API entirely and use XMPP directly. You'd need some way to sign the user in to an XMPP service, and add the bot to their roster (or have an endpoint that accepts messages without adding the bot to the roster). A non-trivial amount of work but definitely possible, and pretty!Brettbretz
Are you guys both from google? Sounds like a typical Office Hallway discussion. :) Anyways, I'm currently creating a messenger like program, running xmlrpc between desktop to server. The main value proposition from the channel is the server push capability. It doesn't sound like google's xmpp service would easily provide this, or am I wrong?Hone
it's much more than a chat app. I'd like to think of it as the google wave of chat apps. Sorry about the lack of details, We're operating in the dark until release.Hone
P
3

If possible, you might think about directly using XMPP. There are several for C#.

You might want to get yourself a copy of FireFox + FireBug. Then take a look at the 'net' tab of FireBug, while playing with someones demo app (or make your own). You should be able to follow the requests through, then emulate them in your C# code.

clarification: I am not suggesting to use XMPP to talk to the channel API but for the communication between your client application and your App Engine app. I suggested using FireBug because it will be very clear that the traffic is JSON.

Purely answered 5/12, 2010 at 3:51 Comment(2)
busted out fiddler, confirmed what Moishe said below, looks like it's comming back as Json, not xmpp.Hone
I was suggesting to use XMPP instead of the Channel API. If directly using XMPP is an option, it will just remove an extra layer of failure points (the channel API).Purely

© 2022 - 2024 — McMap. All rights reserved.