So I’ve been playing quite a while with different sensors data, like Sonar, Infra Red, Accelerometer and GPS. As you might saw from previous post I’ve chosen to use I2C protocol to speak to the sensors, because it’s super easy and reliable and also I don’t need any DAC/ADC convertors. But now another task to be solved – all these sensors supply quite a lot of changing data like distance to obstruction, coordinates and angle information.
Pulling this data every second is not a nice solution, simply because it will generate extra load by establishing connection, especially if I’m going to use 3G dongle instead of WiFi. Also 1 second poll is too slow for distance – because it is a few more inches of moving.
So I’ve started to dig and found WebSockets – this technology is supported by mostly all common browsers and very simple – client (http) establish connection and after server can send updates (push messages) and accept more messages from a client, so probably I’m going to change even move controls to this protocol!