I need to send some data to my client, and I want to know if using push notifications is better than using sockets.
I heard some say that sockets are not good because they can stop working if the mobile phone is changing it’s IP(anyway how often does this happen).
How reliable are sockets> when would you rather go for push notifications?
Push notifications are for:
-When you want to send information to the device that the user didn’t request first (generally a ping that there’s new data on the server that the user will want to download)
-When there’s no guarantee that the application is running.
Sockets are for:
-When the application is running – Aka, user clicks on something they want to download, data is sent via socket.
Also, on Android, push notifications max out at 4K of data, because (as previously mentioned) they’re only really meant to notify, not to transmit large amounts of data. For that you’ll need to use sockets anyway. Furthermore, you’ll need to deal with the fact that sockets do stop sending data for a variety of reasons – The user hops wifi networks, goes through a tunnel, drives through an area with spotty reception, etc, etc.