0

As far as I can tell push notifications work on apps because clients register their devices and have a unique ID and then the notifications are forwarded to that unique ID through a persistent connection (a connection that is constantly open). In other words, say in facebook, a user wants to send a message to another one, then the message is sent to a central server on facebook, it is forwarded from there to either Apple or Google (or both, I do not know), and then the server by Apple or Google forwards the message to the recipient whose ID matches the one that was meant from the sender. Fine. The process is:

sender > facebook server > Apple / Google > receiver

What if the application itself had organized a VPN for its clients, say facebook had its own VPN. Then, wouldn't it be true that such a message could go to the receiver immediately from the sender through a route on the VPN of the form:

sender > receiver

Moreover, with such an approach the clients do not have to have a connection open. For example they could have a server listening to a port on the VPN, and then routing of the messages in the VPN would have to be dealt through a facebook server and the underlying telecommunications infrastructure, thereby omitting the communication to an Apple or Google server. So, such an approach appears to have two advantages over push notifications:

  • no persistent connections for the clients, and
  • no need to communicate with an Apple or Google server.

What are the drawbacks of such an approach and it is not used, but instead we have push notifications that both have persistent connections as well as require the need to communicate with an Apple or Google server so that the notifications can reach their destination?

Diego C Nascimento
  • 2,801
  • 1
  • 17
  • 23
MightyMouse
  • 13,208
  • 8
  • 33
  • 43
  • 3
    "Moreover, with such an approach the clients do not have to have a connection open" -- sure they do. How else do you think the VPN works? Even if the VPN supports tearing down connections after disuse, then you cannot send a message through the VPN from the server to the client, because there is no connection. – CommonsWare Sep 18 '13 at 12:17
  • Sorry, but this seems as if it was taken from a speech of the PHB from Dilbert in a meeting he tries to go all techie with buzzwords on technology he overheard from a tech discussion... – ppeterka Sep 18 '13 at 12:19
  • @CommonsWare Perhaps this is the answer and what I do not know. I thought that we could have a server listening to a port on VPN, similarly to regular servers that have real, physical IP addresses and are waiting for connections to serve, but doing that over the VPN address. In other words, two "regular" servers on internet can communicate with each other directly if they know each other's IP address, with no need for a man-in-the-middle like Apple or Google in the case of push notifications. Does my explanation make sense on what I am trying to say? – MightyMouse Sep 18 '13 at 12:24
  • @ppeterka66 I am asking because I do not know. I am not suggesting anything. If you could explain where I am wrong with my reasoning I would appreciate it. In my question I imply that this has to be wrong or there are severe drawbacks with such an approach. What are they? I am next to clueless about network communication, but this problem somehow comes up. I also posted this question yesterday with no answers: http://stackoverflow.com/questions/18859732/real-world-cross-platform-decentralized-asynchronous-peer-to-peer-communication Thank you for your time in advance if you can help. – MightyMouse Sep 18 '13 at 12:31

1 Answers1

4

VPN is not meant for that, but anyway they are yet (client->VPNServer->client) and so client-server architecture.

What you want is P2P, but most of the users today (desktop and mobile) are behind a NAT, and so can't receive network requests without proper and specific configuration of the NAT.

Anyway I can think on some alternatives, but they will not widespread work. One can be:

The client based on some server, create a NAT entry by uPNP for its own LAN address in a agreed port with that server. The client that will open the connection in communication with the server now knows it can open a connection to that address and port directly. (Problem: Not all NAT's support uPNP configuration, a small part of the users can't even configure their NATs because they have no access to it)

Other

The NATs listen on some TCP/IP ports in the public IP for a new protocol. This protocol on top of TCP/IP is that will tunnel the communication, inform the LAN address or some session aggregated later that the NAT should redirect the packets. (Problems: new protocol, need to implement in NAT's, some security risks)


Note: NAT is good. Think of a place with 15 computers in the LAN. Now if NAT does not existed, all computers in the LAN will need a different real Internet IP. Internet IP's are not cheap, so the cost will be so much higher, and the Internet IP starvation will be more fast.

Diego C Nascimento
  • 2,801
  • 1
  • 17
  • 23
  • It may be silly, but, do you know if there can be p2p communication without NAT and without persistent connections between the peers (on mobile phones as well)? With VPN I wanted to avoid NAT for the communication, but apparently I did not manage to do that. Thank you for the answer Diego. – MightyMouse Sep 18 '13 at 14:47
  • Without persistent connections? Just use some non connection oriented protocol like UDP. Without NAT?! What you mean? NAT are part of the network. If your question is, if it don't has behind a NAT it will work, the answer is yes. – Diego C Nascimento Sep 18 '13 at 14:50
  • I meant port forwarding with NAT. As of UDP, this appears to be the approach used by Skype, but they also use super nodes to route messages so, the communication is not direct again. It is not true p2p again, and there has to be a reason. – MightyMouse Sep 18 '13 at 14:56
  • When you send a UDP datagram from inside the LAN to WAN, if the NAT don't know the protocol, what is most of the cases, it will just add that to their "routing" table, with a time-out (when it seems no more traffic in that and delete the entry). That way the packets from the other end can reach the user. BUT, if the user does not have sent the UDP packet, there's not a way a packet could reach the LAN computer other than configuring the NAT. (Well, there's some tries like sending a packet first to a know server, but some NATs will block the response if – Diego C Nascimento Sep 18 '13 at 15:05
  • the packet is not originated from the server. So, it can/or not work, its not a success solution) I don't know about Skype sorry. – Diego C Nascimento Sep 18 '13 at 15:09
  • Thanks. I believe that this completely answers my question. Have a great day! :) – MightyMouse Sep 18 '13 at 15:12