Search code examples
iosobjective-cpushvoipopentok

How to notify users of call requests within iOS app?


I'm trying to place OpenTok video calls within an iOS app but am stuck on a good mechanism for notifying users of an incoming call in real time (within a few seconds). Are push notifications my only feasible option or is there some other way? Would like to avoid this since APNS makes no guarantee of notification delivery.

I suppose I could create some server scripts that poll every few seconds, but it seems like there must be a better solution.


Solution

  • As a VoIP app, this app is allowed to register a socket that the OS will monitor for you, and wake you when there is traffic on it. Your app will connect to your server and perform a long-poll. When there is a call, your server will send data to the client on the connection, and if your app is suspended, iOS will awaken it to deal with the incoming data.

    VoIP apps are allowed to set a keep-alive timeout, so that you can periodically reconnect to your server, and are automatically launched on boot to service incoming calls.

    See "Implementing a VoIP App" and "Tips for Developing a VoIP App" in the iOS App Programming Guide.