Search code examples
androidoutlookpush-notificationfirebase-cloud-messagingauthenticator

How is two way authentication so instantaneous?


Sorry, I realise this probably a complete noob question. But I've spent so much time trying to find an answer and at this point not even sure if my keywords are right. Please please guide :(

Here goes -

How is two-way authentication so instantaneous? We are having the age-old push vs fetch debate regarding downloading certain time-sensitive updates in our mobile app. 'Fetch is better' team claims that there can be potential delays with push notifications via FCM. Additionally, they also claim that our android app can essentially do via frequent fetch what the web job detecting changes for push notifications will do so why implement all that. Are we stuck in 2011? probably :(

All this made me curious about two-way authentication from Microsoft/ banks approving transactions. Are they implemented differently to REST API? How are they so instantaneous? When I search anything it just tells me how to set it up. Can you please advise how it is architected etc or keywords to discover ourselves? Thank you in advance.


Solution

  • Firebase Cloud Messages system is simply a masked GCM. Google Cloud Messages works as follow:

    There is simply a TCP socket waiting in accept mode on a cloud Google server. The TCP connection had been initiated by the Google Play application.
    When this TCP client socket receives some message, the message contains information such as the package name of the application it should be addressed to, and of course - the data itself. This data is parsed and packed into an intent that is broadcast and eventually received by the application.

    You can find the detailed reply here

    As far as I know, with the current technologies, a true PUSH notification system cannot be created.
    There are mainly two ways to simulate PUSH notifications:

    • Polling which is good for some environments and systems but not for all
    • TCP socket in wait mode (see above) which is the most used system

    Obviously there are upsides and downsides for both system (see here for example)