设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客
LUPA开源社区 首页 业界资讯 软件追踪 查看内容

Socket.IO 1.2.0发布,重要bug修复和API更新

2014-10-28 16:31| 发布者: joejoe0332| 查看: 1670| 评论: 0|原作者: oschina|来自: oschina

摘要:   Socket.IO 1.2.0 发布,包括重要的 bug 修复和一些 API 更新。更新内容如下:服务器Fixed the npmmainproperty in the chat example (GH#1766) Some grammar fixes to the chat example strings (GH#1784) Fixed ...

  Socket.IO 1.2.0 发布,包括重要的 bug 修复和一些 API 更新。


更新内容如下:

服务器

  • Fixed the npm main property 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 resource option when used through.set (GH#1690) [rase-]

  • Replaced the server constructor without the new keyword in README with createServerto avoid confusion (GH#1626) [thanpolas]

  • Fixed grammar issues in the README (GH#1788) [jamesanthonyferguson]

  • The origins option now takes a function so allowed origins can dynamically change at run time (GH#1777) [akamensky]

  • Fixed the Server#close example (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 closing state (GH#285) [lpinca & 3rd-Eden]

  • Updated the debug module 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 connect function (now public API) (GH#732) [nkzawa]

  • Updated repository url (GH#762) [haqii]

  • Delaying transport closing until the drain event 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):

1
2
3
4
5
6
7
8
var sockets = io({
  origins: function (origin, fn) {
    if (origin == 'http://foo.example') {
      return fn(nulltrue);
    }
    return fn(nullfalse);
  }
});

初始化客户端的时候,不需要协议也能运行相关 urls :

1
var socket = io('//localhost:3000');

你可以手动管理重新连接:

1
2
3
4
5
6
7
8
9
10
11
12
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 获取新客户端:

1
<script src="https://cdn.socket.io/socket.io-1.2.0.js">script>

Socket.IO 实现了实时双向的基于事件的通讯机制。旨在让各种浏览器与移动设备上实现实时app功能,模糊化各种传输机制。

Socket.IO 是跨平台,多种连接方式自动切换,做即时通讯方面的开发很方便,而且能和expressjs提供的传统请求方式很好的结合,即可以 在同一个域名,同一个端口提供两种连接方式:request/response, websocket(flashsocket,ajax…).


酷毙

雷人

鲜花

鸡蛋

漂亮
  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部