Internet Data Usage and Battery Consumption of Server-Sent Events and Websockets on Android Mobile Applications.

 In this comparison of Server-Sent Events vs Websockets we got the next results:


The app to get the statistics was "gsam battery monitor". We can see that websockets got a very lower usage of internet data in Kilobytes, this test was for one hour. Every 5 minutes to both applications the server was sending a message or emitting a message and both applications were listening for his respective event.

To implement websockets on android we use native socket.io https://socket.io/blog/native-socket-io-and-android/ and for make the client of Server-Sent Events on android we use oksse library: https://github.com/heremaps/oksse 

Source: Youtube video:


https://www.youtube.com/watch?v=XP4NJPxq-BA&feature=youtu.be


This results surprise me because a have read that websockets is not efficient in mobile apps for the full-duplex connection however Server-Sent events using http 2 every 3 seconds is sending to the client a message to keep alive the connections and this is not good because the client starts to lose internet data and the invoice  go hight.


No hay comentarios:

Con la tecnología de Blogger.