Doing broadcasts with http server push?
We are designing a system with a PC base station and 100 Android mobiles communicating over WiFi. They will use XLM-RPC as the method of mobile to base station communication. However, sometimes the base station needs to broadcast a message to all mobiles. Should we use "http server push" for this, ie, have the base station leave the connections open to all the mobiles? Is there a better way? Publish-subscribe is possible, but doesn't seem ma开发者_如何学Goture on Android yet.
Why do not in fact use a real broadcast? Let the station to send the message to a broadcast address and the net layer will do the job for you.
Of course this solution can be good if you can switch to an XML-RPC over udp.
Otherwise you have to select() a pool of sockets opened, updating every client you have to notify.
The first approach being very very light in resource load, the last being more affordable.
Its all a balance between this two opposites.
精彩评论