Permalink
Browse files

Merge branch 'master' of github.com:LearnBoost/socket.io-client

  • Loading branch information...
2 parents 3eaf15e + 56ddb4e commit 15dbe74fc7793939914832aabf6334468318c9e9 @dvv dvv committed Jun 30, 2011
Showing with 75 additions and 48 deletions.
  1. +10 −0 History.md
  2. +58 −40 dist/socket.io.js
  3. +2 −2 dist/socket.io.min.js
  4. +1 −1 lib/io.js
  5. +2 −3 lib/namespace.js
  6. +2 −2 package.json
View
@@ -1,4 +1,14 @@
+0.7.3 / 2011-06-30
+==================
+
+ * Fixed; acks don't depend on arity. They're automatic for `.send` and
+ callback based for `.emit`. [dvv]
+ * Added support for sub-sockets authorization. [3rd-Eden]
+ * Added BC support for `new io.connect`. [fat]
+ * Fixed double `connect` events. [3rd-Eden]
+ * Fixed reconnection with jsonp-polling maintaining old sessionid. [franck34]
+
0.7.2 / 2011-06-22
==================
View
@@ -1,4 +1,4 @@
-/*! Socket.IO.js build:0.7.2, development. Copyright(c) 2011 LearnBoost <dev@learnboost.com> MIT Licensed */
+/*! Socket.IO.js build:0.7.3, development. Copyright(c) 2011 LearnBoost <dev@learnboost.com> MIT Licensed */
/**
* socket.io
@@ -22,7 +22,7 @@
* @api public
*/
- io.version = '0.7.2';
+ io.version = '0.7.3';
/**
* Protocol implemented.
@@ -268,14 +268,14 @@
* @api public
*/
- util.merge = function merge(target, additional, deep, lastseen){
+ util.merge = function merge (target, additional, deep, lastseen) {
var seen = lastseen || []
, depth = typeof deep == 'undefined' ? 2 : deep
, prop;
- for (prop in additional){
- if (additional.hasOwnProperty(prop) && util.indexOf(seen, prop) < 0){
- if (typeof target[prop] !== 'object' || !depth){
+ for (prop in additional) {
+ if (additional.hasOwnProperty(prop) && util.indexOf(seen, prop) < 0) {
+ if (typeof target[prop] !== 'object' || !depth) {
target[prop] = additional[prop];
seen.push(additional[prop]);
} else {
@@ -1218,7 +1218,7 @@
* @api private
*/
- Transport.prototype.onData = function(data){
+ Transport.prototype.onData = function (data) {
this.clearCloseTimeout();
this.setCloseTimeout();
@@ -1247,7 +1247,7 @@
return this.onHeartbeat();
}
- if (packet.type == 'connect' && packet.endpoint == ''){
+ if (packet.type == 'connect' && packet.endpoint == '') {
this.onConnect();
}
@@ -1491,7 +1491,7 @@
* @api private
*/
- Socket.prototype.publish = function(){
+ Socket.prototype.publish = function () {
this.emit.apply(this, arguments);
var nsp;
@@ -1619,7 +1619,7 @@
if (self.options.connectTimeout) {
self.connectTimeoutTimer = setTimeout(function () {
if (!self.connected) {
- if (self.options['try multiple transports']){
+ if (self.options['try multiple transports']) {
if (!self.remainingTransports) {
self.remainingTransports = self.transports.slice(0);
}
@@ -1743,7 +1743,7 @@
* @api private
*/
- Socket.prototype.onConnect = function(){
+ Socket.prototype.onConnect = function () {
this.connected = true;
this.connecting = false;
if (!this.doBuffer) {
@@ -1790,8 +1790,8 @@
*/
Socket.prototype.onError = function (err) {
- if (err && err.advice){
- if (err.advice === 'reconnect'){
+ if (err && err.advice) {
+ if (err.advice === 'reconnect') {
this.disconnect();
this.reconnect();
}
@@ -1899,7 +1899,6 @@
'undefined' != typeof io ? io : module.exports
, 'undefined' != typeof io ? io : module.parent.exports
);
-
/**
* socket.io
* Copyright(c) 2011 LearnBoost <dev@learnboost.com>
@@ -1971,7 +1970,7 @@
if ('function' == typeof fn) {
packet.id = ++this.ackPackets;
- packet.ack = fn.length ? 'data' : true;
+ packet.ack = true;
this.acks[packet.id] = fn;
}
@@ -1994,7 +1993,7 @@
if ('function' == typeof lastArg) {
packet.id = ++this.ackPackets;
- packet.ack = lastArg.length ? 'data' : true;
+ packet.ack = 'data';
this.acks[packet.id] = lastArg;
args = args.slice(0, args.length - 1);
}
@@ -2084,7 +2083,11 @@
if (packet.advice){
this.socket.onError(packet);
} else {
- this.$emit('error', packet.reason);
+ if (packet.reason == 'unauthorized') {
+ this.$emit('connect_failed', packet.reason);
+ } else {
+ this.$emit('error', packet.reason);
+ }
}
break;
}
@@ -2143,9 +2146,10 @@
exports.websocket = WS;
/**
- * The WebSocket transport uses the HTML5 WebSocket API to establish an persistent
- * connection with the Socket.IO server. This transport will also be inherited by the
- * FlashSocket fallback as it provides a API compatible polyfill for the WebSockets.
+ * The WebSocket transport uses the HTML5 WebSocket API to establish an
+ * persistent connection with the Socket.IO server. This transport will also
+ * be inherited by the FlashSocket fallback as it provides a API compatible
+ * polyfill for the WebSockets.
*
* @constructor
* @extends {io.Transport}
@@ -2178,7 +2182,7 @@
* @api public
*/
- WS.prototype.open = function(){
+ WS.prototype.open = function () {
this.websocket = new WebSocket(this.prepareUrl());
var self = this;
@@ -2201,8 +2205,8 @@
};
/**
- * Send a message to the Socket.IO server. The message will automatically be encoded
- * in the correct message format.
+ * Send a message to the Socket.IO server. The message will automatically be
+ * encoded in the correct message format.
*
* @returns {Transport}
* @api public
@@ -2233,7 +2237,7 @@
* @api public
*/
- WS.prototype.close = function(){
+ WS.prototype.close = function () {
this.websocket.close();
return this;
};
@@ -2246,7 +2250,7 @@
* @api private
*/
- WS.prototype.onError = function(e){
+ WS.prototype.onError = function (e) {
this.socket.onError(e);
};
@@ -2255,8 +2259,8 @@
*
* @api private
*/
- WS.prototype.scheme = function(){
- return (this.socket.options.secure ? 'wss' : 'ws');
+ WS.prototype.scheme = function () {
+ return this.socket.options.secure ? 'wss' : 'ws';
};
/**
@@ -2267,7 +2271,7 @@
* @api public
*/
- WS.check = function(){
+ WS.check = function () {
return 'WebSocket' in window && !('__addTask' in WebSocket);
};
@@ -2278,7 +2282,7 @@
* @api public
*/
- WS.xdomainCheck = function(){
+ WS.xdomainCheck = function () {
return true;
};
@@ -2348,9 +2352,9 @@
* @api public
*/
- Flashsocket.prototype.open = function(){
+ Flashsocket.prototype.open = function () {
var self = this, args = arguments;
- WebSocket.__addTask(function(){
+ WebSocket.__addTask(function () {
io.Transport.websocket.prototype.open.apply(self, args);
});
return this;
@@ -2365,15 +2369,28 @@
* @api public
*/
- Flashsocket.prototype.send = function(){
+ Flashsocket.prototype.send = function () {
var self = this, args = arguments;
- WebSocket.__addTask(function(){
+ WebSocket.__addTask(function () {
io.Transport.websocket.prototype.send.apply(self, args);
});
return this;
};
/**
+ * Disconnects the established `Flashsocket` connection.
+ *
+ * @returns {Transport}
+ * @api public
+ */
+
+ Flashsocket.prototype.close = function () {
+ WebSocket.__tasks.length = 0;
+ io.Transport.websocket.prototype.close.call(this);
+ return this;
+ };
+
+ /**
* Check if the Flashsocket transport is supported as it requires that the Adobe
* Flash Player plugin version `10.0.0` or greater is installed. And also check if
* the polyfill is correctly loaded.
@@ -2382,7 +2399,7 @@
* @api public
*/
- Flashsocket.check = function(socket){
+ Flashsocket.check = function (socket) {
if (
typeof WebSocket == 'undefined'
|| !('__initialize' in WebSocket) || !swfobject
@@ -2400,13 +2417,14 @@
// Only start downloading the swf file when the checked that this browser
// actually supports it
- if (supported){
- if (typeof WEB_SOCKET_SWF_LOCATION === 'undefined'){
+ if (supported && !Flashsocket.loaded) {
+ if (typeof WEB_SOCKET_SWF_LOCATION === 'undefined') {
// Set the correct file based on the XDomain settings
WEB_SOCKET_SWF_LOCATION = path.join('/');
}
WebSocket.__initialize();
+ Flashsocket.loaded = true;
}
return supported;
@@ -2421,15 +2439,15 @@
* @api public
*/
- Flashsocket.xdomainCheck = function(){
+ Flashsocket.xdomainCheck = function () {
return true;
};
/**
* Disable AUTO_INITIALIZATION
*/
- if (typeof window != 'undefined'){
+ if (typeof window != 'undefined') {
WEB_SOCKET_DISABLE_AUTO_INITIALIZATION = true;
}
@@ -2998,7 +3016,7 @@ var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="Sho
* @api public
*/
- XHR.xdomainCheck = function(){
+ XHR.xdomainCheck = function () {
return XHR.check(null, true);
};
@@ -3457,7 +3475,7 @@ var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="Sho
script.async = true;
script.src = this.prepareUrl() + '/?t=' + (+new Date) + '&i=' + this.index;
- script.onerror = function(){
+ script.onerror = function () {
self.onClose();
};
Oops, something went wrong.
View
@@ -21,7 +21,7 @@
* @api public
*/
- io.version = '0.7.2';
+ io.version = '0.7.3';
/**
* Protocol implemented.
View
@@ -1,4 +1,3 @@
-
/**
* socket.io
* Copyright(c) 2011 LearnBoost <dev@learnboost.com>
@@ -70,7 +69,7 @@
if ('function' == typeof fn) {
packet.id = ++this.ackPackets;
- packet.ack = fn.length ? 'data' : true;
+ packet.ack = true;
this.acks[packet.id] = fn;
}
@@ -93,7 +92,7 @@
if ('function' == typeof lastArg) {
packet.id = ++this.ackPackets;
- packet.ack = lastArg.length ? 'data' : true;
+ packet.ack = 'data';
this.acks[packet.id] = lastArg;
args = args.slice(0, args.length - 1);
}
View
@@ -1,7 +1,7 @@
{
"name": "socket.io-client"
, "description": "Socket.IO client for the browser and node.js"
- , "version": "0.7.2"
+ , "version": "0.7.3"
, "main" : "./lib/io.js"
, "browserify": "./dist/socket.io.js"
, "homepage": "http://socket.io"
@@ -22,7 +22,7 @@
, "express": "2.3.11"
, "jade": "0.12.1"
, "stylus": "0.13.3"
- , "socket.io": "0.7.1"
+ , "socket.io": "0.7.3"
, "socket.io-client": "0.7.1"
}
, "engines": { "node": ">= 0.4.0" }

0 comments on commit 15dbe74

Please sign in to comment.