Pregunta

I am looking for the underlying mechanism of rabbitmq for NAT traversal.

Assume:

  1. 1.Server S is deployed on Cloud
  2. Many Client C1-CN are deployed as customers, which they are behind NAT.
  3. Server S needs to Notify the clients

I am wondering how the server find the IP/port of the clients? does it rely on a kind of ICE server? or it saves the IP/ID of each clients a big lookup table (LUT). Or clients sends lots of packet and server puts the msg in the response packets?

tnx

@hardillb: Thanks, I see, but this approach might cause severe problem for me. The reason is that I wanna deploy it in an ultra low power microcontroller. Therefore, if my micro continuously sends keep-alive packets to the server it would be discharged very soon and hence I need to replace its battery very fast. But in my application, it should last for at least 1 years. I am wondering if there is any way to prevent sending these kind of packets and put the micro in sleep mode. and whenever there is a command, it can wake up? I have heard about CoAP (the micro becomes server) but still it has the NAT traversal problem. I am wondering if you know an approach to overcome this problem?

¿Fue útil?

Solución

The client opens a TCP connection to the server via the nat gateway. The nat gateway keeps a table mapping inbound connections from clients to outbound connection to the server, this allows return packets to be returned to the client.

Assuming the client is purely a subscriber (does not publish any messages) it sends a keep-alive packet at regular intervals to let the server know it is still connected (this also has the benefit of keeping the connection alive through a nat gateway).

When the server receives a message on a topic that the client is subscribed to it simply forwards that message over the existing connection to that client.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top