Is it possible to do long polling with WCP on Windows Phone 7?
I want to push data to from a server to Windows Phone 7 client in an intranet environment.
I certainly 开发者_JAVA百科don't want to use Microsoft Push Notification Service for this.
Is it possible to use WCF and long polling
I wrote this article on long polling - perhaps it would help?
http://xyzzer.wordpress.com/2011/03/10/real-time-client-server-communication-on-windows-phone-with-long-polling/
Long polling is just asynchronous programming with a, potentially, very long time out before the callback is called.
There is nothing in WCF (assuming that's what you meant in the title) or Windows Phone 7 that prevent this from being used. There is, however, a big consideration specific to using this technique on Windows Phone 7 though.
The issue you'll have with this on WP7 is that the app you create cannot run in the background and so must be constantly running from the time that the request was sent to the time that the response is received. Depending on how long your polling will be this may or may not be an issue.
As a partial solution you could consider disabling idle detection as this would keep the app running until the user stopped it (or triggered tombstoning).
Push Notifications are THE solution to sending a message (or a response) to a phone when the application isn't running.
Hopefully this will change in the future but that's how it is for now.
精彩评论