I know this isn't exactly kotlin related, but I th...
# android
g
I know this isn't exactly kotlin related, but I think you guys might have some good advice. I need to manage a pub-sub connection between an android device and a server. Ideally, that means the app would need to listen to the server. How would you manage that? Periodically raise a connection (the server keeps messages on a buffer and fire them as soon as there is a connection established)? The app needs to at least look real time (instantly fire messages sent from app, receive messages without much delaying).
stackoverflow 8
e
Instead of keep listening to the server, you could use push notification to notify the Smartphone that there are new data available or sending the data directly
v
IMHO push notifications are not reliable, especially for something that needs to be real time
I would go for pooling/mqtt when the app is in foreground and rely on push notifications only when the app is not being used
👍 1
g
I think I'll stick to the MQTT continuosly open when on foreground. An open socket will not be as costly as pooling and won't waste as much bandwidth. Thanks