-1

I need to have the user be notified when an event is triggered on a server (a message is sent to them). I have tried using background fetch, but it does not run frequently enough. Using a socket.io websocket disconnects when the app is put in background.

How would you get a message notification instantly while in the background, like discord or any other IM app, when sent?

I am coding in XCode with Swift and Storyboards.

Please don't ask for code snippets, if you really want I can give you the socketio code i'm using, but it would just be irrelevant to this question.

Thanks for your help in advance.

IBreh4478
  • 38
  • 3
  • Does this answer your question? [How to set up push notifications in Swift](https://stackoverflow.com/questions/24899257/how-to-set-up-push-notifications-in-swift) – zbee Jan 27 '20 at 18:04

1 Answers1

0

The short answer is: Silent Push Notification

You have to capture the silent notification and update your app state accordingly from the AppDelegate

javier rivarola
  • 500
  • 3
  • 6