I am using node.js socket.io library for building a android chat application with socket connection. but socket connection consume too much power that it drain battery by very high rate.
so is it possible to minimize power consumption by any mean of keeping socket idle or anything
below is my code where i have added in IOConnection.java class
public void transportMessage(String text) {
// my logic
}
After lot of google and debuging i finally found solution and i hope it may help someone.
Actual Problem:
this problem is less concern to battery but more with Garbage collector which goes crazy after calling socket.disconnect() method. it cause your app to slow down and drain battery quickly.
Solution:
use java-websocket.jar version 1.3.0 instead of websocket.jar to resolve this.
More information:
see this issue and read comment of kikoso and lukas-hetzenecker