Domanda

We need to have a persistent connection between servers on WAN and LAN. Basically multiple LAN servers have to register with a server on Internet and always keep an open connection, because we can not ask clients who own serves on LAN to set up port forwarding, and because there might be firewall issues.

What are my options here? I am thinking, either Websockets, or servers on LAN long polling our server on the Internet. Is there a better solution?

È stato utile?

Soluzione

Your options are - considering you want to avoid problems with proxies and firewalls - probably:

  • Use websockets, either port 80 or 443
  • Use long polling (that's not really persistent, if you need bidirectional communication!) port 80 or 443
  • Encapsulate whatever data into a http request, using port 80
  • Use port 443 with ssl encryption, and do whatever you want on the protocol level. Normally, you won't have any problems using even some strange custom protocol as long as you use this port with ssl encryption, as neither firewalls nor proxies normally (try to) inspect what you're doing when they sense what they think is https.

Everything else is probably out of scope for you as far as I get the scenario, but you should be able to do what you need using port 443 with some protocol made for persistent connections (it's possible with websockets, but you'll run into other problems really fast (like missing ping/pong implementations) then if you don't custom build your code, which would probably make it pointless to use websockets in the first place)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top