开发者

Consuming Google Channel API in C#

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?


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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜