简体   繁体   中英

recommended method for two way communication between android app and server

I'm writing a bingo application for android.

bingo game has alerts and notifications that supposed to go from the server to the client on real time.

the client also needs to notify the server in real time whenever he yells bingo or any other events.

now.. my question is, what's the recommended method for two ways communication between server and android client?

should I use websockets? regular sockets? long polling ? anything else ?

if I use sockets as the method of choice, what happens when the cellular phone is changing wan networks ? do i need to detect such a thing and reconnect the socket?

any information regarding the issue would be greatly appreciated.

The easiest method is to use Android GCM for server to client communication, and a RESTful API for client to server communication.

You can even try Parse library, that comes with their own SDK and solves most of the configuration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM