Listen to UDP Socket in Background using GCDAsyncUdpSocket

526 Views Asked by At

I have one application that connects to a network device (in LAN) over UDP and listen for new messages using GCDAsyncUdpSocket. It works fine in foreground but in background it is not able to respond. I want to show a local notification when I receive a message from UDP. Please suggest how we can achieve this by following Apple policies.

Thanks & Regards, Amit

1

There are 1 best solutions below

0
On

All sockets are set to sleep when the app is in background.

The option you have is to do Fetching Small Amounts of Content Opportunistically

In case your app is a VoIP app, you can keep a TCP socket live and the OS will inform you when data is received. This way you can set a "wake up" message to be sent over TCP and then use UDP for the actual data transfer.