I have a device, located in a Wi-Fi local network possibly without Internet connection, which sends notifications to the devices that are connected to it using a web-socket.
But when I lock the phone or press the home button, my application goes to background mode and the web-socket connection gets closed, so since then any notification doesn't get to the phone.
I know I can do this by using remote notifications (with Apple Push Notification Service), but my device is intended to work on any Wi-Fi network (with or without Internet access) or generating its own Wi-Fi access point (and therefore without Internet access).
So the question is: Is it possible to have a persistent connection, like in Android where I can maintain a connection in a background service?
No, you can't if you want your app in the App Store.
If not (for example this is an Enterprise app), you can use kind of hacks, like silent audio or voip but this will drain battery a lot.
In iOS, only specific app types are allowed to run in the background:
Apps that play audible content to the user while in the background, such as a music player app
Apps that record audio content while in the background
Apps that keep users informed of their location at all times, such as a navigation app
Apps that support Voice over Internet Protocol (VoIP).
Apps that need to download and process new content regularly
Apps that receive regular updates from external accessories
unlimited backgrounding on ios with silent audio
Apple docs - background execution