服务器端用java推送 [英] Server side push with java

查看:99
本文介绍了服务器端用java推送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

cometd 作为java的长轮询框架是否更简单?
因为我需要的是 - 客户端指定一些参数并将它们发送到服务器。
服务器处理它们并开始连续地将消息推送回客户端(看起来像b-b一样,每个服务线程?)。客户端接收消息并显示它们。客户端有可能停止侦听并实际停止服务器发送消息的服务。也许我太懒了,
但是我想要的不是那么简短透明。

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 cometd's examle was not that short and transparent as I wanted it to be.

不是基于HTML5。

推荐答案

使用 SSE (服务器发送事件)您可以完全按照您的解释做,但不幸的是它是HTML5技术。

如果您感兴趣,可以查看html5rocks以获取更多信息。

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.

这篇关于服务器端用java推送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆