by weinzierl · 9y ago · 0 comments
I have a technical question:
> We immediately realized that protocols like SIP, which traditionally required holding open long-lived connnections in order to receive incoming calls, were not going to be compatible with the mobile environment.
Ok, so far so good.
> Instead we built our own simple REST-based signaling protocol [...], and used push notifications instead of long-lived connections to notify the client of incoming calls.
So, no long lived connection but a "simple REST-based signaling protocol". How is that supposed to work without a long lived connection?
> Actual push notifications hadn't been invented yet, though, so we created our own push infrastructure by sending encoded SMS messages that the app would silently intercept and interpret instead.
OK, that's pretty clear again.
> Over time, we switched to push notifications when they were created by Google and Apple [...]
But don't push notifications basically work over a long lived connection? Of course it's better to have just one long-lived connection to Apple instead of one for every communication App, but in the end if you want real time signalling in a mobile environment you won't get around a long lived connection, don't you? At least that is my understanding, but I'm always happy to learn something new.
It took me a while to understand this, and while other people have answered the question, I want to chime in in hopes it helps other people understand.
Yes, push notifications work over a long-lived connection. The way push notifications in iOS and Android work is that all of your push notifications for all of your apps get sent over one long-lived connection, instead of one per app. Also, (at least on Android), the notifications can be held and batched, so that the device doesn't have to wake up as often to receive notifications. And finally, push notifications are handled by a system service that can wake up other applications, so that messaging applications can be aggressively hibernated to save power, and still receive notifications.
The downside is that your notifications are all centralized. And while a well-designed app like Signal will only send a "wake-up" packet over the push notifications channel, it's still a worrying dependency for some people.
There's a proposed RFC called webpush that would let you implement/choose your own push to be used by multiple apps: https://datatracker.ietf.org/wg/webpush/documents/
I think part of the convenience is on the server side. The server also only maintains a single connection to Google/Apple, instead of keeping millions of idle ones.
Android users like me can enjoy it too ! :)
What they're mainly talking about, however, is that it's inappropriate to have a persistent connection (as would be required with SIP) continuously running in an app while the app is doing nothing but waiting for a call. Once that notification comes through and the call is accepted, then of course a persistent connection is required for the duration of the call. When the call is over, the Signal app can shut down all network traffic and wait to be reactivated via a mobile push notification when the next call comes in.