Search code examples
androidnode.jsgoogle-app-enginesocketschannel-api

Android constant connection website


I'm looking for options for communication between an Android device - running a native app - and a website.

In basics, the Android device is just a sensor for movement, while the website is the receiving end and will process the sensor data. The website will then have to visualize this movement.

The goal is that this happens instantly and constantly, as the sensor data can easily reach up to 50 updates a second.

I'm looking for some proper options and possibly shared experiences for streaming this data as far as possible;

So far it has crossed my mind to;

  • Use techniques like Bluetooth, Wifi Direct or USB. Probably not reachable from a website.
  • Use a Node.js server for a simple socket connection.
  • Use Google App Engine. The channel (java) client would be nice for this, but it seems that the app engine can only be the transmitting end.

Solution

  • I would do this:

    The node socket.io server just takes the sensor data and broadcasts it.

    About socket.io:

    Socket.io uses Websockets. However, if the client doesn't support Websockets, it falls back to long polling etc... to emulate Websockets. On top of that, it gives you a pub/sub framework which Websockets doesn't provide out of the box.

    The new version of socket.io (available on github) uses engine.io to provide the websocket abstraction and then puts a pub/sub framework on top of that.