Reputation: 173
My app have a connection with a php Server where the data is saved so the app its like a chat the user send a message and the other can see and awnser my doubt is if I stay constantly request the server to update the messages its gonna affect the performance and what is the better way to do this?
Upvotes: 0
Views: 45
Reputation: 7711
The best way to do this is using Push Notifications, you don't need to maintain an open connection but receive a message from your server that it's telling you there is a new message. The received message is too short so maybe you will not be able to send the message from the Push Notification but you can tell the app that a new message is ready in your server. To do this in PHP you can refer to this link and link2. Another chance is to use sockets, I give you a link about This.
Upvotes: 1
Reputation: 151
You can make requests in your app to ask php server if the new messege is there. It will be working.
The second way is to implement in your server and app Google Cloud Messaging . It is "wired" into device and can push messege into device.
Upvotes: 0