发布于 2014-10-28 02:19:25 | 442 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的精品教程,程序狗速度看过来!

Socket.IO

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


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 createServer to 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):

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…).



历史版本 :
Socket.IO 2.0 发布,实时应用程序框架
Socket.IO 1.4.1/1.4.2/1.4.3,支持 NativeScript
Socket.IO 1.3.6 发布,bug 修复版本
Socket.IO 1.3.5 发布,解析器修复
Socket.IO 1.3.4 发布,BUG 修复版本
Socket.IO 1.3.3 发布,修复解析器的 BUG
Socket.IO 1.3.0 发布
Socket.IO 1.2.1 发布
Socket.IO 1.2.0 发布,重要 bug 修复和 API 更新
Socket.IO 1.1.0 发布
最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务