20. Comet
Comet is a web application model in
which a long-held HTTP request allows
a web server to push data to a
browser, without the browser explicitly
requesting it.
-WikiPedia
基于 HTTP 长连接的“服务器推”技术,是一
种新的 Web 应用架构。基于这种架构开
发的应用中,服务器端会主动以异步的方
式向客户端程序推送数据,而不需要客户
端显式的发出请求。 - 百度
百科
54. 搭建一个 Realtime Web 平台
• 基于 socketio-netty也做一个 Realtime Web 平
台
• 初始化 IOHandler 接口接口,上传到服务器,初
始化应用实例,获得一个 API KEY
• 客户端引用 JS :
<script src="http://domain.com/yourfirebase.js"></script>
• 使用 API KEY :
var socket = yourbase.load("08235-sdxd-d23523s-d23d");
socket.on('news', function (data) {
console.log(data);
socket.emit('my other event', { my: 'data' });
});
进阶阅读 :
http://www.blogjava.net/yongboy/archive/2012/0
55. 实时 Web(Realtime Web)
The real-time web is a set of
technologies and practices that enable
users to receive information as soon
as it is published by its authors, rather
than requiring that they or their
software check a source periodically
for updates.
新的名词 / 概念,对数据推送的重新包装
---Wikipedia
对数据推送的最合适的解读
http://help.adobe.com/en_US/ColdFusion/10.0/Developing/WSe61e35da8d318518767eb3aa135858633ee-7fea.html web-socket-js ,跨浏览器透明使用 WebSocket https://github.com/gimite/web-socket-js <!-- Import JavaScript Libraries. --> <script type="text/javascript" src="swfobject.js"></script> <script type="text/javascript" src="web_socket.js"></script> <script type="text/javascript"> // Let the library know where WebSocketMain.swf is: WEB_SOCKET_SWF_LOCATION = "WebSocketMain.swf"; // Write your code in the same way as for native WebSocket: var ws = new WebSocket("ws://example.com:10081/"); ws.onopen = function() { ws.send("Hello"); // Sends a message. }; ws.onmessage = function(e) { // Receives a message. alert(e.data); }; ws.onclose = function() { alert("closed"); }; </script>
eg : 消息队列 JAX-RS 也是增强
Servlet 3.0 推出时间
JBoss AS 7: https://community.jboss.org/wiki/WebsocketSupportInAS7
Atmosphere The Asynchronous WebSocket/Comet Framework 是一个 Java 技术框架,其提供了通用的 API 来使用许多 web 服务器的 Comet 和 WebSocket ,这些 web 服务器包括了 Tomcat 、 Jetty 、 GlassFish 、 Weblogic 、 Grizzly 、 JBossWeb 、 JBoss 和 Resin ,其还支持任何支持 Servlet 3.0 规范的 web 服务器。 客户端支持不是那么强大