问题
I have a certain concept in mind, but I an unsure what my possibilities are.
- User enters a name (html form) on a webpage
- Webserver sends push notification to the Android device of the user
- Application looks for this name in the contactslist and finds the corresponding phone number
- Application instantly sends this information back to the webserver, where the user can use the returned phone number.
The only step I am unsure about is #4. I presume I'd have to use a temporary MYSQL database and use reverse AJAX or something alike to get the returned data to the user without him having to refresh the page (this entire process needs to be completed within a couple of seconds at most - the faster, the better). This all sounds like a very hack-ish approach to me though, I was hoping any of you could hint me with better ways of tackling this - or maybe a good resource to the approach I described. It's hard to find solutions when you're not sure what it is you're looking for.
Much obliged!
回答1:
I can think of two ways of solving #4
- poll "did I get the response yet?, did I get the response yet?..."
- or use websockets. here's a post I found that might be useful: post
Here's one interesting approach to it all using node.js: nowjs
If you plan to use Androids C2DM, check out the min-max delivery times.
来源:https://stackoverflow.com/questions/5858412/fetch-data-from-android-to-webserver