• Best Way to Communicate Between 2 Raspberry Pi's Over the Internet?
    11 replies, posted
So someone has suggested to me previously to use Socket.io to communicate between Pi's over a local network and I got it to work successfully. Now I'd like to know (and if it's doable in a couple weeks) if I can have them communicate in a similar way (like socket.send()) over the internet. I've seen suggestions of port forwarding but that it is insecure so I don't want to risk it. I've also seen remot3.it by Weaved. Maybe this would be the better option if anyone has experience with it?
everything runs on ports forward a port if you want to make one of your pi be a server for the other to connect to alternatively you might find some obscure service that acts as a lightweight server that meets your needs, and the pi can both connect to it instead [editline]3rd November 2016[/editline] if you think someone is going to hack your pi and it's something that would actually suck to have hacked, well tough beans that's just a lesson in network safety and how to better handle authentication of your devices
[QUOTE=bitches;51304837]everything runs on ports forward a port if you want to make one of your pi be a server for the other to connect to alternatively you might find some obscure service that acts as a lightweight server that meets your needs, and the pi can both connect to it instead [editline]3rd November 2016[/editline] if you think someone is going to hack your pi and it's something that would actually suck to have hacked, well tough beans that's just a lesson in network safety and how to better handle authentication of your devices[/QUOTE] I actually couldn't care less about getting the Pi hacked since t has no sensitive information. But if I were to forward a port, would I be able to send data between the two chips in the same fashion as socket.send() for example?
sorry, I don't know the specifics of socketing over the web the short lazy answer is that you can, or if you can't there's something just as easy to accomplish it by
Using rabbitmq messaging service could work and might be easiest or client server architecture. Raspberry pi would be the clients and then you'd need to build a server.
Well I don't need to explicitly use socket functions. As long as I can use python code to send values back and forth I'm willing to use any method.
What I normally do is using databases on a hosted webserver. Then you don't have to care about forwarding ports, which is sometimes impossible todo (like behind Carrier-grade NAT). So one Raspberry could insert or update a database row, and the other Raspberry could check the database every 5th second or whatever you'd like.
[QUOTE=AGMadsAG;51309269]What I normally do is using databases on a hosted webserver. Then you don't have to care about forwarding ports, which is sometimes impossible todo (like behind Carrier-grade NAT). So one Raspberry could insert or update a database row, and the other Raspberry could check the database every 5th second or whatever you'd like.[/QUOTE] This is a really dumb way to do it, polling a remote database each N seconds is a pure waste of resources. Also if you have access to a webserver you'd better just slap together a small web app that would use websockets or some shit to just pass data from one client to another.
[QUOTE=mijyuoon;51309456]This is a really dumb way to do it, polling a remote database each N seconds is a pure waste of resources. Also if you have access to a webserver you'd better just slap together a small web app that would use websockets or some shit to just pass data from one client to another.[/QUOTE] Yeah I know it aint effective, but for my use cases it works perfectly (concept/prototype cases). I rarely use it in production, but would like to know more about the correct method. Do you have any resources that I could look up?
If you are using NodeJS(It sounds like yes because you are using Socket.io, unless there is another implementation out there) you can just have one Pi listen on a port with a simple TCP server and the other connect to it. Here is a good example: [url]https://gist.github.com/tedmiston/5935757[/url]
Every language has a socket abstraction ^
[QUOTE=Rayboy1995;51317512]If you are using NodeJS(It sounds like yes because you are using Socket.io, unless there is another implementation out there) you can just have one Pi listen on a port with a simple TCP server and the other connect to it. Here is a good example: [url]https://gist.github.com/tedmiston/5935757[/url][/QUOTE] Thank you I will look into this.
Sorry, you need to Log In to post a reply to this thread.