How to run cocos creator android build in background

Hello everyone,

I’m facing an issue in android application. Actually i have a poker game that uses web socket.
Whenever we minimize the application the socket connection stops listening event/broadcast fired from the server and all the action pauses. So every-time we reconnects the web socket connection even if the application is in background for 2 seconds which is very annoying.

I have tried commenting the code written in onpause and onResume AppActivity.java but the application crashes on startup.

protected void onResume() {
    super.onResume();
    SDKWrapper.getInstance().onResume();

}

@Override
protected void onPause() {
    super.onPause();
    SDKWrapper.getInstance().onPause();

}

So i want to run my application in the background so it can maintain it’s game state as it is real time application.

Cocos Creator Version: 2.0.9
programming Language: JavaScript

**UPADATE: ** If we able to maintain web socket connection in the background that would also be fine for me.