Optimizing for Doze on Android for Connection persistance

I am developing an application using Firebase through Angularfire. On Android versions < 6.0 (pre M) the application’s live model updates (provided through firebase) works without any issues. However on Android Marshmallow (and N) devices, the connection to Firebase is not maintained.

During the execution of the app, when a new request is initialized, the connection between the App and Firebase is re-established and then the updates to the data entities are retrieved. (Albeit only temporarily, until next connection is made)

I Tested on a number of devices and confirmed that it works for Android versions < 6.0 and that it was not a specific device issue.

My suspicion is that the socket connection needed for the live updates is being terminated by the underlying Android system as part of its effort to be more conservative with battery.

Is there any way to force the underlying Android system to maintain the connection while the app is opened.