title: How to use push notifications and network together in React Native while the app is running in the background
body: <p>I am developing an app that is going to contain a simple messaging feature (think of a basic whatsapp). The app is going to use websockets to catch news messages from the server when there is a new message for them. When the app is in the background it would need to still maintain a websocket connection to the server so that when there is new message for it can be sent to the users app. From there the state will be updated and phone notification event will occur.</p>
  <p>The problem is that as soon as the device is locked all the code stops running. How can I keep alive a websocket connection and perform push notifications based on messages from the server when the app is running in the background?</p>