Socket.IO 1.2.0 发布下载,包括重要的 bug 修复和一些 API 更新。
更新内容如下:
服务器
-
Fixed the npm
mainproperty in the chat example (GH#1766) [BrianGeppert] -
Some grammar fixes to the chat example strings (GH#1784) [matthewcanty]
-
Fixed room autopruning (memory leak fix) (GH#2 GH#12) [hallucynogenyc & rase-]
-
Added tests to check room autopruning (GH#1792) [rase-]
-
Fixed the backwards compatibility option for the
resourceoption when used through.set(GH#1690) [rase-] -
Replaced the server constructor without the
newkeyword in README withcreateServerto avoid confusion (GH#1626) [thanpolas] -
Fixed grammar issues in the README (GH#1788) [jamesanthonyferguson]
-
The
originsoption now takes a function so allowed origins can dynamically change at run time (GH#1777) [akamensky] -
Fixed the
Server#closeexample (GH#1773) [AjayMT] -
Fixed typo in README code example (GH#280) [reem]
-
Added missing support for XSS filters on IE (GH#254) [pawelatomic]
-
Allow upgrades if a socket is still in
closingstate (GH#285) [lpinca & 3rd-Eden] -
Updated the
debugmodule in socket.io-adapter (GH#7) [keskival] -
Fixed jsonp tests for transport close deferring (GH#289) [rase-]
-
Fixed the install issue of the indexOf module (GH#16) [rase-]
客户端
-
Fixed binary transport check if the content-type header contains a charset (GH#342) [bimusiek]
-
When upgrading wait for it to finish before closing transport (GH#356) [nkzawa]
-
Fixed close defer tests (GH#346) [rase-]
-
Fixed “jsonp polling iframe removal error” on connection close (GH#349) [aaronk6]
-
Fixed namespace tests after dependency upgrade in socket.io server [rauchg]
-
Possibility to use a relative url without schema (GH#754) [toshipon]
-
Fixed manual reconnection via
connectfunction (now public API) (GH#732) [nkzawa] -
Updated repository url (GH#762) [haqii]
-
Delaying transport closing until the
drainevent to send all packets left in the buffer (GH#351, GH#352) [nkzawa & rase-] -
Now supports PhantomJS (GH#34) [divdavem]
-
Fixed an error in strict mode (GH#355) [nkzawa]
-
Had priority XHR over XDR (GH#341) [yujiosaka]
-
Enabled to stop reconnection attempts (GH#766) [nkzawa]
-
Fixed reconnection after reconnecting manually (GH#767) [nkzawa]
-
Fixed reconnection tests (GH#768) [rase-]
socket.io-redis
-
Prettier badges (GH#12) [Krinkle]
-
Readme updates to instruct in Redis authentication (GH#24) [Siedrix]
新 API 功能示例:
你可以指定一个函数来检测 origins,代替之前的 string representation (though the string representation still works as usual):
var sockets = io({
origins: function (origin, fn) {
if (origin == 'http://foo.example') {
return fn(null, true);
}
return fn(null, false);
}
});
初始化客户端的时候,不需要协议也能运行相关
urls :var socket = io('//localhost:3000');
你可以手动管理重新连接:
var socket = io({ forceNew: true });
socket.once('connect', function() {
socket.disconnect();
});
socket.once('disconnect', function() {
socket.once('connect', function() {
console.log('Connected for the second time!');
});
socket.connect();
});
跟往常一样,你可以通过 CDN 获取新客户端:
<script src="https://cdn.socket.io/socket.io-1.2.0.js"></script>
Socket.IO 实现了实时双向的基于事件的通讯机制。旨在让各种浏览器与移动设备上实现实时app功能,模糊化各种传输机制。
Socket.IO 是跨平台,多种连接方式自动切换,做即时通讯方面的开发很方便,而且能和expressjs提供的传统请求方式很好的结合,即可以 在同一个域名,同一个端口提供两种连接方式:request/response, websocket(flashsocket,ajax…).
Node.js+socket.io+聊天室源码 http://www.linuxidc.com/Linux/2013-10/91617.htm
Node.Js入门[PDF+相关代码] http://www.linuxidc.com/Linux/2013-06/85462.htm
Node.js安装与配置 http://www.linuxidc.com/Linux/2013-05/84836.htm
Socket.IO 和 Node.js 入门 http://www.linuxidc.com/Linux/2012-05/60447.htm
使用HTML5,WebSockets,nodejs和socket.io构建实时游戏 http://www.linuxidc.com/Linux/2012-06/61798.htm
Socket.IO 的详细介绍:请点这里
Socket.IO 的下载地址:请点这里
本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-10/108552.htm
