开发者

Server side push with java

is it any simpler way then cometd as long-polling framework for java? Because what I need - is client specifies some parameters and sends them to server. Server process them and starts contonuously pushing messages back to client (looks like Thread-per-Service?). Client receivs messages and displays them. Client has possibility to stop listening and actually stop server's service to send messages. Maybe I'm too lazy, but come开发者_StackOverflowtd's examle was not that short and transparent as I wanted it to be.

Not HTML5 based.


With SSE ( server sent events ) you can do exactly what you explained you want to do, but unfortunately it's HTML5 technology .
If your interested you can check html5rocks for further information.


Well if you are too lazy for cometd or reverse AJAX you can deploy a web service endpoint to your client (preferably restful and not SOAP) and have your server send back messages to your web service (acting as a client).

It is simple to implement this.

In your clien't initial request to the server, along with the other parameter, you can also send the port (or URL) that your endpoint is listening for notification.

Then you just have to define the notification events and implement the rest of the logic.


These guys Atmosphere Asynchronous WebSocket/Comet Framework really made nice job at simplifying the server push process with fallbacks mechanism when browser and/or server parts does not support websockets

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜