All IM apps rely on Google or Apple (on their respective platforms) for the push notifications. The alternative is polling in relatively small intervals, but that wakes up the app, which uses the battery without any real usage.
And if the OS decides to kill your app's process, your polling dies with it and you don't get notifications.
And if the OS decides to kill your app's process, your polling dies with it and you don't get notifications.