1

My server is a REST platform (built with asp.net MVC 4 web api), and my client is ios application (in objective-c of course). Currently for all operations the client queries the server with http POST,GET,PUT,DELETE. But there is one situation where the server needs to notify the client that something happened.

The Apple way is a push notification, which is OK when the user authorize push notifications for the app, but I need to notify the app (when its in the foreground) even when the user turn off the push notifications.

now there are 2 ways that it can be done:

  1. the client query every couple of seconds the server (in http GET) if something happened (are we there yet? are we there yet? :)
  2. the client open a socket to the server somehow and leave it open, waiting for the server to notify it through the open session that something happened.

So what do u suggest to do? 1 or 2? or is there a third way? and if option 2 can someone lead me to how to do that efficiently? considering that my app should handle above 100,000 active users?

Thank you

ozba
  • 6,522
  • 4
  • 33
  • 40

1 Answers1

0

Have a look at SignalR. It's the Microsoft realtime library but someone has written an iOS client library for it.

starskythehutch
  • 3,328
  • 1
  • 25
  • 35
  • Can you elaborate on that? to go the way you suggested here means I need to install on the server the SignalR microsoft library and on the client the iOS client library and open a persistent connection between the ios client and the C# server using the signalR API? – ozba Aug 01 '12 at 20:39
  • Also I see that it's used mainly for broadcasting to a group, while I need to send to specific users. is it efficent for that task too? – ozba Aug 01 '12 at 20:55
  • You'll need to have a server hosting the SignalR "hub" but the idea is that the the client registers with the hub, which opens a persistant connection to it. The system where the event occurs then posts a message to the hub with the event details. The hub then send, in realtime, the update to the client device/s. It's all pretty cool, but does require somewhere to host the hub. – starskythehutch Aug 01 '12 at 20:56
  • Yes, you can send to specific users. Look at this question for more information: http://stackoverflow.com/questions/7872589/call-specific-client-from-signalr – starskythehutch Aug 01 '12 at 20:57