Background service running indefinitely

I have an application that I want to receive at any moment a push notification, but the problem is that the user can close the app, probe the Background Mode “https://ionicframework.com/docs/native/background-mode/” but it only works while the app is open or in the background and was not deleted after this does not work, what I look for is similar to what does whatsapp do to receive a message despite the fact that the app is closed

Using push notifications doesn’t require your app to be open in the background.

I have the problem that a socket.io that executo closes the connection and also the notifications do not arrive until unlock the phone and launch the application of background