简体   繁体   English

我可以将通知从WP8推送到Windows Store应用程序吗?

[英]Will I be able to push notifications from WP8 to a Windows Store app?

I need to pass messages between a WP8 app and a Windows Store app. 我需要在WP8应用程序和Windows Store应用程序之间传递消息。 It's sort of a "peer-to-peer" situation in that they will both send and respond to messages from each other, but it's also sort of a "client/server" situation in that the Windows Store app will have 1..N WP8 apps that it is conversing with. 这是一种“点对点”的情况,因为它们将彼此发送和响应消息,但是,这也是一种“客户端/服务器”的情况,因为Windows Store应用程序将具有1..N与之交谈的WP8应用程序。

After being beaten about the head and shoulders for my first ideas of trying to use either email or SkyDrive rather sneakily, I'm now considering these possible architectures: 在尝试偷偷使用电子邮件或SkyDrive的最初想法被打败之后,我现在考虑以下可能的体系结构:

1) Direct Push Notifications (a) The WP8 app sends Push Notifications to the Windows Store app via a URI it is provided after this conversation takes place: Windows Store app: " Will you send me updates? " WP8 app: " Yes. " Windows Store app: " Okay, here's where to send them. " (b) Windows 8 responds to the arriving msgs. 1)直接推送通知(a)WP8应用程序通过此对话后通过提供的URI向Windows Store应用程序发送“推送通知”:Windows Store应用程序:“ 您是否会向我发送更新? ” WP8应用程序:“ 是。 ” Windows Store应用程序:“ 好,这是将它们发送到的地方。 ”(b)Windows 8响应到达的消息。

2) Push-Pull using the Cloud (a) WP8 sends data to the cloud (Azure?) (b) Windows 8 app periodically polls for it 2)使用云进行推拉(a)WP8将数据发送到云(Azure?)(b)Windows 8应用程序定期对其进行轮询

3) SSL (Using components from someone like /NSoftware (IP*Works)) 3)SSL(使用/ NSoftware(IP * Works)之类的组件)

The messages from WP8 are rather frequent (every 15 minutes, on average), but small/short (short enough to be a Tweet, in fact). WP8发出的消息相当频繁(平均每15分钟发送一次),但消息的发送量很小/很短(实际上足够短,可以用作Tweet)。 The Windows 8 app deals with these msgs "behind the scenes." Windows 8应用程序在后台处理这些消息。 The user is not aware of them until he runs the associated app. 用户直到运行相关的应用程序,才意识到它们。

There weren't any question marks :) but here's my take: 没有任何问号:),但是这是我的看法:

  1. Push notifications would certainly work, but given your "behind the scenes" comment, you may want to look specifically into "raw notifications" , which do use the push notification mechanism but aren't associated with UI (like a tile, toast or badge). 推送通知当然可以工作,但是考虑到您的“幕后”评论,您可能需要专门研究“原始通知” ,该通知确实使用了推送通知机制,但与UI无关(例如磁贴,吐司或徽章) )。 Pushed toast notifications, for instance, are dropped if the client if off-line. 例如,如果客户端脱机,则推送的吐司通知将被丢弃。

  2. The frequency of the messages makes me leery of the polling approach given impact on battery life (that said, not sure how a push notification with background task would compare). 消息的频率使我对轮询方法感到担忧,因为它会影响电池寿命(也就是说,不确定带有后台任务的推送通知会如何比较)。 With the polling approach too you'd need to have some way on your "cloud service" to maintain messages (storage) and then feed back the right messages on each poll, etc. You'd also need to handle the scaling and availability aspects that WNS would do 'free.' 使用轮询方法时,您还需要在“云服务”上有某种方式来维护消息(存储),然后在每次轮询中反馈正确的消息,等等。您还需要处理扩展性和可用性方面WNS会做到“免费”。 Not rocket science, but more work. 不是火箭科学,而是更多的工作。 The push notification is kind of 'fire-and-forget'. 推送通知是“一劳永逸”的。

  3. With sockets, you might have more control to the extent the sandboxed model exposes functionality you need. 使用套接字,您可以在沙盒模型公开所需功能的范围内进行更多控制。 It seems like more moving parts though, and I'd likely go that route only if the other two approaches are otherwise unviable. 不过,似乎还有更多的活动部分,只有在其他两种方法不可行的情况下,我才可能走这条路线。

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

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