简体   繁体   中英

How do Messaging Applications “Bypass” Firewalls?

there. I am currently making a python net-chat program of sorts. Currently it only works on a local network and cannot send messages to clients connected outside the network due to their router's firewall blocking the messages that are being sent to them.

So, my question is: How do messaging applications "bypass" firewalls to send messages to clients? Do they use something like "fetching" the information from the server and it tunnels the message back to them? But even that would use large amounts of battery if it was fetching every second. And fetching every minute is just impractical. I was thinking that they use more of a "push" protocol much like my IMAP server "pushes" my emails to my cellphone. But how do those connections go through the firewall?

I think what you are looking for is a push notification architecture of some kind. I would point you to these two resources:

Essentially the client device sets up a full duplex connection with a notification server which it keeps open indefinitely. App servers register with the notification server and when they won't to notify a client device they send the message to the notification server that uses the open connection to the client device to notify them. Usually different apps use the same notification server for efficiency reasons.

So to recap, client device establishes a duplex connection with the notification server, app server sends notification for client to notification server, notification server sends the notification to the appropriate client.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM