Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Signal R Vs Push Notifications for real time applications like Chat

I want to create a chat application for ios, android and windows phones as well as it should work with browsers in the future. My search led me to using Signal R with Azure Mobile Services(AMS).

My questions:

1) SignalR uses Websockets under the hood. Is websocket supported in Android, IOS, windows phones and all mobile/desktop browsers??

2) If not, how will it effect using SignalR with AMS?

3) Or should I just use Push notifications supported in AMS?

4) Any sample app/code snippet you can share. Note that I will be using Xamarin for my app development.

5) Any advice you can give for same.

like image 603
Ankur Avatar asked Feb 02 '15 06:02

Ankur


2 Answers

Azure Mobile Services has SignalR integrated, and Azure Mobile Services provide a SDK for client apps, I suppose it is provide out-of-the box

See

Real-time with ASP.NET SignalR and Azure Mobile .NET Backend Master the Managed Azure Mobile Services Backend–Part Four

High value mobile backend capabilities included

You will find many capabilities included in Mobile Services and readily available for your Web API. Mobile push notifications, real-time notifications with SignalR (auto-scaled out), social auth for your consumer apps, offline data sync for occasionally connected scenarios, to name a few.

Samples:

  • https://github.com/gshackles/RealTimeGallery
  • Sample to help developers to implement Push Notification, through Azure Notification Hubs, in mobile applications.

Note:

  • Azure Mobile Service is based in WebAPI!

  • For that you want, you should not use only Push Notification because Push Notification in iOS could not be read by the application if the user ignore it, only in android or windows you can get and save it. Another thing that can be a problem is the fact if the app is running you should not show the push notification and you should show a pop up with the notification... and the push notification can have a delay from the Push Notification Service (Apple, GCM, WNS...). Push notification are a notification that something happened in the app when the user is not using it.

In my opinion you should use AMS+SignalR for realtime communication and then Push Notification for update the user then he not using the app.

like image 159
saramgsilva Avatar answered Sep 21 '22 23:09

saramgsilva


Using SignalR is efficient to save yourself from hitting any push notification cap if you ant to limit your costs. But you'll need to either turn notifications on/off at the right time when the app becomes active or inactive, otherwise the app may go in the background and push notifications won't be sent.

You can use a pure push approach where notifications are shown when the app is inactive/in the background, and whenthe app is active, you simply intercept the notification in the app, consume it and cancel it so it doesn't get shown. I have written a blog post on this approach along with 3 samples in Github for iOS, Android and Windows Universal at http://www.ageofmobility.com/2014/10/06/azurechatr-building-a-cross-platform-chat-app-for-windows-ios-android/.

like image 25
ActiveNick Avatar answered Sep 22 '22 23:09

ActiveNick