服务器的PhoneGap推:SignalR VS Azure的通知中心 [英] Server to Phonegap push: SignalR vs Azure Notification Hub

查看:228
本文介绍了服务器的PhoneGap推:SignalR VS Azure的通知中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我在一种两难与我的PhoneGap的应用开发去的:对实时事件通知,我应该去的Azure通知集线器或SignalR?

Well, I'm in a kind of a dilemma to go on with my Phonegap application development: for real time event notification, should I go with Azure Notification Hub or SignalR?

有关我的理解,SignalR有利于通过使用的Web套接字的实时Web应用程序。而通知中心可以很容易地跨多个平台发送推送通知。
为了方便回应,让我解释一下,我现在有什么我的应用程序是应该做的结构。

For my understanding, SignalR is good for real time web applications through the use of Web Sockets. Whereas notification hub makes it easy to send push notifications across multiple platforms. To make it easy to respond, let me explain the structure that I currently have and what my app is supposed to do.

应用程序:
它基本上是一个应用程序,用户可以创建群组,并邀请其他用户。用户还可以做一团联机,以便其他用户可以通过输入的组。而组处于联机状态,并且用户已经输入,就可以发送问题,交换信息等。

The App: It's basically an app where users can create groups and invite other users. The user can also make a group "online" so other users can "enter" the group. While the group is online and the user have entered , they can send questions, exchange messages and so forth.

需要:
当用户组中的发问,或进入/离开一个组,其他用户需要看到在应用程序屏幕新用户。我可以做一个轮询服务器上检查和更新根据用户界面,但这是后话了现代社会不允许。我对这个问题的搜索导致我两件事:SignalR和NotificationHub

The need: When a user ask a question in a group, or enter/leave a group, the other users needs to see the new user in the app screen. I could do a polling on the server to check that and update the UI according, but this is something the modern days don't allow. My searches on the subject lead me to two things: SignalR and NotificationHub.

目前的架构:
客户端 - > PhoneGap的应用与Backbone.js的。
后端 - > Asp.NET的Web API与实体框架和Azure的SQL Server中。

The current architecture: Client -> PhoneGap application with backbone.js. Backend -> Asp.NET Web API with Entity Framework and Azure Sql Server.

我已经投入使用的通知集线器和标签的一些思考。
例如,当用户输入一个在线基,它向服务器发送一个请求以注册grouplisten:{的groupId}的标签。然后,服务器注册到用户的设备的标签,也触发一个通知与标签grouplisten:{的groupId}的所有其他设备,因此,其他用户更新与最近加入用户的用户界面。此外,当用户离开组时,它向服务器发送一个请求,以删除grouplisten:{的groupId}的标签,并还notifiy用grouplisten:{的groupId}的设备。但这个简单的例子,貌似这样可以变得难以管理。

I've already put some thinking in the use of notification hubs and tags for that. For example, when a user enter an online group, it sends a request to the server to register a "grouplisten:{groupId}" tag. The server then registers the tag with the user's device and also fires a notification to all other devices with the tag "grouplisten:{groupId}", so the other users update the UI with the recently joined user. Also when the user leaves the group, it sends a request to the server to remove the "grouplisten:{groupId}" tag and also notifiy the devices with "grouplisten:{groupId}". But with this simple example, looks like this can become unmanageable.

推荐答案

这两种技术都有各自的优点和缺点在移动平台上:

Both technologies have their pros and cons on mobile platforms:

优点:


  • 非常适合于实时传递,时间或从服务器接收通知是很重要的。

  • Web客户端是由所有主要浏览器,IE8 +,火狐,Chrome,Safari浏览器和Android的WebView,iOS的Safari浏览器,IE浏览器的移动支持,因此他们正在运作良好。

  • 解可以写在JS,而不需要对知道

缺点:


  • 必需的专用服务器,但有可能与共享主机可能,因为不是性能饿了。
  • 托管
  • 在科尔多瓦特别需要,而不是依靠其SignalR提供了重新连接的机制(这是必需的iOS可能放弃对电池preserving网络连接,在Android不是一个问题了更好的用户体验手动连接管理,到目前为止)。

  • 它有Safari浏览器在iOS上一个已知的问题(这需要与长轮询配置中运行,的你可以找到更多关于这个问题这里)的 - 你用的力不同的IP地址为SignalR服务器在iOS的无缝体验
  • - 真实世界的场景频繁Ajax请求。
  • Required dedicated server, but possible hosting with shared hosting probably, since not performance hungry.
  • In Cordova particularly requires manual connection management for better user experience, instead of relying on the re-connection mechanism which SignalR provides (This is required for iOS which could drop network connection for battery preserving, on Android not an issue so far).
  • It has a known issue with Safari on iOS (which needs to run with long polling configuration, you can find more on that issue here) which - on real world scenarios with frequent ajax requests - forces you to use a different IP address for the SignalR Server for a seamless experience on iOS.

优点:


  • 使用现有的谷歌,苹果和MS的基础设施来提供通知给用户,并且他们每个人不能保证通知的立即交货。你必须分别读取每个平台:

    • 苹果公司的<一个href=\"https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW4\"相对=nofollow> APNS文档服务质量部分

    • 谷歌的: GCM高级主题

    • Use existing infrastructure of Google, Apple and MS to deliver notifications to the user and each of them not guarantee immediate delivery of the notifications. You have to read each platforms separately:
      • Apple: Quality Service section of APNS docs
      • Google: GCM Advanced Topics

      缺点:

      • No guarantee for the immediate deleivery.
      • Required working with each native platform's languages. (There excellent plugin for Cordova https://github.com/sgrebnov/cordova-plugin-azure-notificationhub, but it is does not allow receiving notifications when application paused on Android and don't have 64 bit build on iOS)

      这篇关于服务器的PhoneGap推:SignalR VS Azure的通知中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆