I want to start a little project, where I want to connect several of my devices. Some are Android mobile devices, others are desktop devices like a PC or laptop. Furthermore I want keep the project as generic as possible. Means I want to share it, so other people can use it.
By connecting I mean send messages between them. My problem is, that I’am not sure what technology or architecture to use, and hope to get some advice from you. (I think this question is more about software architecture then gorilla vs. shark)
I have considered several approaches already. I looked at Google’s Cloud Messaging, but that seems not to fit my requirements, where several users can register to send independent messages. It looks more like, sending from one master to several devices.
The next thing I thought about was something lile VLC did with its Android remote app, where the desktop application hosts something like a server to which the mobile app must connect. This seems to be limited to LAN and only fits to about 80% of my use cases.
Is there another approach which does not require something like a server who is aware of all clients, which has to seperate the user’s devices and route the messages?
You can use ZeroConf (a.k.a. Bonjour) to discover other devices on a local network and create an ad hoc network between them. If you want to be able to connect devices across larger networks, though, you’re going to need a server with a fixed address so that all parties have some well-known address that they can connect to. Most devices (laptops, tablets, phones, etc.) don’t have a fixed address, so they’re often hard to find. Further, they’re often behind firewalls which make them impossible to connect to even if you do know where to find them. Instead, each device needs to initiate the connection. Two devices obviously can’t both initiate the same connection, but having them both connect to some server that relays messages between them solves the problem.
You also need to consider usability. You don’t want to run background software that’s constantly listening for connections on a mobile device simply because listening means that the WiFi radio has to be running, and keeping that radio running all the time is a quick way to kill your battery. You don’t have that problem with a stationary server.
3