简体   繁体   English

最小化WP7 App网络负载

[英]Minimize WP7 App network load

I have made an App that connects to a WCF service and checks every 1.5 second by a DispatcherTimer if the phone has the most recent image. 我制作了一个连接到WCF服务的应用程序,并通过DispatcherTimer每1.5秒检查一次手机是否具有最新图像。 If not, it will download the most recent image. 如果没有,它将下载最新的图像。 It might be that the phone has the most recent image for quite some time, say 10 minutes. 可能是手机具有相当长一段时间(例如10分钟)的最新图像。 If that is the fact, then the 1.5 second interval is way too fast. 如果是这样,那么1.5秒的间隔太快了。 But when the image is changed on the server, I want it to be downloaded by the App as soon as possible, say, within seconds. 但是,当在服务器上更改映像时,我希望应用程序尽快(例如,在几秒钟内)下载该映像。

I understand I could use the Push notification service of Microsoft, but my project is about using a closed network, no internet available. 我知道我可以使用Microsoft的Push通知服务,但是我的项目是使用封闭的网络,没有可用的互联网。

So my question is, in what way would I lower and minimize my network use? 所以我的问题是,我将以何种方式降低和最小化网络使用? Any help and tips appreciated, thanks! 任何帮助和技巧表示赞赏,谢谢!

If you are using a closed WiFi network - even every 1,5 seconds updates polling isn't too much of an overhead for the network. 如果您使用的是封闭的WiFi网络-即使每隔1.5秒更新一次轮询,网络的开销也不会太大。 It is for your device's battery though. 不过,这是为设备的电池供电的。

Make it every 10 seconds and you are in a "golden mean". 每10秒进行一次,您就处于“中庸之道”。

As for the WCF itself, just make sure you are returning a bool value from the server in response to the client's app question "Is there any picture updates?" 至于WCF本身,只需确保您正在从服务器返回布尔值,以响应客户端的应用程序问题“是否有图片更新?” and you have your minimum in data sent back and forth. 这样您就可以最小限度地来回发送数据。

Since Windows Phone doesn't support WCF Duplex channels yet, you can't use the best approach of just configuring the server to notify you only when the pictures are updated on the server. 由于Windows Phone 尚不支持WCF双工通道 ,因此不能使用仅将服务器配置为仅在服务器上更新图片时通知您的最佳方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM