Push server implementation technology?
I'm planning to develop a solution which uses push functionality. There will be a server and mobile device client application.
I need to kn开发者_如何学Goow how to push messages in to the client from the server. That is my client application is passively waiting until a messages comes from the server.
What is the technology behind pushing the messages from the server.
Clients are in the form of Android,J2me,BB,iphone etc
Google for "COMET", you'll get a lot of links. Generally speaking, you want a server framework that can park requests and pick them up when they have data to return. For example, a basic Java Servlet will keep a thread per request, and if you "park" a request (by doing some wait), the thread is suspended along with the request. In this way, you can only have as many clients waiting on a request as you can have threads in the server, which is not enough for big apps.
So, at the very least, you want a system where threads can be reused as requests are paused. As push is becoming popular again, frameworks to support it are blooming, so without more context it is hard to recommend a certain server/framework.
Having said that :-), in the Play Framework (http://www.playframework.org/) there is a sample chat application that uses three variations of "push". If anything, it's worth perusing the code (assuming that you know Java) to get a feel for the various solutions.
Have a look at HTML5 web sockets. It's a way of opening a raw TCP socket socket that works like a TCP socket (with some limitations) but is initiated over HTTP, from the browser, enabling true two-way communication. It's supported in many modern browsers, including the current iOS browser. Android doesn't support it, but there you can fall back on a Flash pixel. It's quite easy to write a Flash file that manages the socket and passes all the information back and forth to Javascript. If you're interested I think I might even have some code I could dig out for you.
精彩评论