Search code examples
socketsraspberry-pikeep-aliveopenvpn

connect to a device behind firewall with low data traffic


I am developing a connected device with a raspberry pi over a 3G connection. My 3G offer gives me a 50 MB max data usage as a limit. I want to be able to exchange very small amount of data with the raspberry Pi from the Internet (eg ~5 kB per day) but I want to be able to communicate with it 24/7.

Of course with the 3G connection, I have no public IP and I cannot do any NAT to access my raspberry directly. Question: how can I communicate with the Rapsberry Pi without using more than 50 MB/month?

I tried an OpenVPN connection but it needs 200 MB per month to keep-alive the connection. I also tried socket.io with node.js to keep a link between my raspberry Pi and my server but again it needs ~ 200 MB per month.

Any idea for sending some kind of notifications with small payloads instantaneously without having a data expensive keep-alive connection?


Solution

  • Afetr many researchs and tests, and thanks to Morne answer I found out 2 solutions for my need:

    • XMPP: protocol used for instant messaging. Do keep alive connections ~30 MB/month
    • MQTT: protoco l used for M2M commubnciations and used by Facebook Messenger. After some tests it uses only 12 MB/month for a keepalive. It has been designed especially for small bandwidth communications. I'll use that. There are some python and node.js packages