javascript - Receiving messages without port forwarding -


i want server able send client message @ time. there may no messages several days, yet if 1 sent, want received (ideally within 1 second or less). how go without setting client server , using port forwarding?

an example of push notifications on mobile device. apple can send push notification iphone instantly. however, iphone isn't acting server. furthermore, iphone may moving network network, , networks aren't forwarding ports iphone. how work? assuming there's sort of persistent connection, how solution scale hundreds of millions of devices connected @ same time?

this question doesn't depend on particular language. i'm working in js. i'm looking conceptual answer, feel free answer in context of language if helps.

remember that, once network connection has been established, data can flow on in either direction. there no requirement peer on "receiving" end of connection receive data!

in presence of non-cellular network*, iphone push notifications work having device connect apple notification server, wait receive data it. no port forwarding necessary, outbound connection device. if connection lost, device reconnect server , "check in" see if missed anything.


*: if device has cellular connection available, making infeasible keep network connection open @ times, may rely on notifications through cellular network itself, kind of sms. that's kind of separate thing altogether.


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -