I'm currently on a project in which we will be communicating between a household appliance (e.g. an oven) with an embedded computer, and a mobile device (phone). Here's a brief summary of the setup:
- The embedded device will be running Java, must likely on Android but possibly some variant of Linux
- The mobile device will be running C# (through Xamarin) on iOS or Android.
- Communication will occur over the internet when the user is not at home, so we need some sort of proxy server to route the messages between the mobile device and the appliance (to circumvent NAT firewalls, etc). I am more or less agnostic to server language/platform
- However, when the user is at home and connected to their Wifi network, we would like communication to occur directly between the appliance and the phone over the LAN, just in case the server is not reachable for some reason. I would imagine this would mean that the appliance has to act as a server.
- The embedded device will be giving the phone "real time" (about every 1-5 seconds) updates about certain data points (e.g. temperature). We may have up to a few thousand clients hitting the proxy server. This is basically a publish/subscribe pattern
- The phone should be able to send action requests to the appliance (e.g. turn on/off, set temperature), and the appliance should be able to respond with a success/fail message. This is basically an RPC pattern
Are there any frameworks out there that support realtime communication over the internet and LAN, publish-subscribe and RPC, and run on both both Java and C#? I have a few good candidates but I especially see no way to share protocols between communicating over the internet and communication over the LAN (is this even possible?). My current shortlist consists of (in order):
- RabbitMQ -- Supports all major platforms, authentication/SSL/PubSub/RPC built in, but I don't see any way to make the two devices talk over a LAN if there is no internet connection if we are running Android appliance-side
- A websocket framework such as SignalR, XSockets, AutoBahn, or Socket.IO. These are either not cross-platform between .Net and Java (XSockets/AutoBahn) or we run into the LAN problem above (SignalR)
- ZeroMQ -- this looks conceptually doable, but it looks quite low-level and looks like you have to re-invent the wheel quite a bit to get even basic PubSub w/ heartbeat monitoring going.
- Doing one of the above over the internet and home-brewing some protocol over raw sockets for communication over the LAN (a little messy, seems like this should be a solved problem already)
XMPP also looks like it could be promising but from what I've seen the community and documentation/examples don't seem robust, I've also read that performance with XMPP is not quite real-time.