mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
build
This commit is contained in:
296
socket.io.js
296
socket.io.js
@@ -1,4 +1,4 @@
|
||||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.io=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
||||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.io = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
@@ -651,7 +651,7 @@ Manager.prototype.onreconnect = function(){
|
||||
this.emitAll('reconnect', attempt);
|
||||
};
|
||||
|
||||
},{"./on":3,"./socket":4,"backo2":8,"component-bind":11,"component-emitter":12,"debug":14,"engine.io-client":16,"indexof":33,"socket.io-parser":41}],3:[function(_dereq_,module,exports){
|
||||
},{"./on":3,"./socket":4,"backo2":8,"component-bind":11,"component-emitter":12,"debug":14,"engine.io-client":16,"indexof":47,"socket.io-parser":41}],3:[function(_dereq_,module,exports){
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
@@ -1091,7 +1091,7 @@ Socket.prototype.compress = function(compress){
|
||||
return this;
|
||||
};
|
||||
|
||||
},{"./on":3,"component-bind":11,"component-emitter":12,"debug":14,"has-binary":31,"socket.io-parser":41,"to-array":44}],5:[function(_dereq_,module,exports){
|
||||
},{"./on":3,"component-bind":11,"component-emitter":12,"debug":14,"has-binary":33,"socket.io-parser":41,"to-array":44}],5:[function(_dereq_,module,exports){
|
||||
(function (global){
|
||||
|
||||
/**
|
||||
@@ -1320,66 +1320,6 @@ Backoff.prototype.setJitter = function(jitter){
|
||||
|
||||
|
||||
},{}],9:[function(_dereq_,module,exports){
|
||||
/*
|
||||
* base64-arraybuffer
|
||||
* https://github.com/niklasvh/base64-arraybuffer
|
||||
*
|
||||
* Copyright (c) 2012 Niklas von Hertzen
|
||||
* Licensed under the MIT license.
|
||||
*/
|
||||
(function(chars){
|
||||
"use strict";
|
||||
|
||||
exports.encode = function(arraybuffer) {
|
||||
var bytes = new Uint8Array(arraybuffer),
|
||||
i, len = bytes.buffer.byteLength, base64 = "";
|
||||
|
||||
for (i = 0; i < len; i+=3) {
|
||||
base64 += chars[bytes.buffer[i] >> 2];
|
||||
base64 += chars[((bytes.buffer[i] & 3) << 4) | (bytes.buffer[i + 1] >> 4)];
|
||||
base64 += chars[((bytes.buffer[i + 1] & 15) << 2) | (bytes.buffer[i + 2] >> 6)];
|
||||
base64 += chars[bytes.buffer[i + 2] & 63];
|
||||
}
|
||||
|
||||
if ((len % 3) === 2) {
|
||||
base64 = base64.substring(0, base64.length - 1) + "=";
|
||||
} else if (len % 3 === 1) {
|
||||
base64 = base64.substring(0, base64.length - 2) + "==";
|
||||
}
|
||||
|
||||
return base64;
|
||||
};
|
||||
|
||||
exports.decode = function(base64) {
|
||||
var bufferLength = base64.length * 0.75,
|
||||
len = base64.length, i, p = 0,
|
||||
encoded1, encoded2, encoded3, encoded4;
|
||||
|
||||
if (base64[base64.length - 1] === "=") {
|
||||
bufferLength--;
|
||||
if (base64[base64.length - 2] === "=") {
|
||||
bufferLength--;
|
||||
}
|
||||
}
|
||||
|
||||
var arraybuffer = new ArrayBuffer(bufferLength),
|
||||
bytes = new Uint8Array(arraybuffer);
|
||||
|
||||
for (i = 0; i < len; i+=4) {
|
||||
encoded1 = chars.indexOf(base64[i]);
|
||||
encoded2 = chars.indexOf(base64[i+1]);
|
||||
encoded3 = chars.indexOf(base64[i+2]);
|
||||
encoded4 = chars.indexOf(base64[i+3]);
|
||||
|
||||
bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
|
||||
bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
|
||||
bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
|
||||
}
|
||||
|
||||
return arraybuffer;
|
||||
};
|
||||
})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");
|
||||
},{}],10:[function(_dereq_,module,exports){
|
||||
(function (global){
|
||||
/**
|
||||
* Create a blob builder even when vendor prefixes exist
|
||||
@@ -1479,6 +1419,8 @@ module.exports = (function() {
|
||||
})();
|
||||
|
||||
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{}],10:[function(_dereq_,module,exports){
|
||||
|
||||
},{}],11:[function(_dereq_,module,exports){
|
||||
/**
|
||||
* Slice reference.
|
||||
@@ -2060,7 +2002,7 @@ module.exports = _dereq_('./socket');
|
||||
*/
|
||||
module.exports.parser = _dereq_('engine.io-parser');
|
||||
|
||||
},{"./socket":18,"engine.io-parser":27}],18:[function(_dereq_,module,exports){
|
||||
},{"./socket":18,"engine.io-parser":29}],18:[function(_dereq_,module,exports){
|
||||
(function (global){
|
||||
/**
|
||||
* Module dependencies.
|
||||
@@ -2792,7 +2734,7 @@ Socket.prototype.filterUpgrades = function (upgrades) {
|
||||
};
|
||||
|
||||
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"./transport":19,"./transports":20,"component-emitter":26,"debug":14,"engine.io-parser":27,"indexof":33,"parsejson":37,"parseqs":38,"parseuri":39}],19:[function(_dereq_,module,exports){
|
||||
},{"./transport":19,"./transports":20,"component-emitter":26,"debug":14,"engine.io-parser":29,"indexof":28,"parsejson":37,"parseqs":38,"parseuri":39}],19:[function(_dereq_,module,exports){
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
@@ -2949,7 +2891,7 @@ Transport.prototype.onClose = function () {
|
||||
this.emit('close');
|
||||
};
|
||||
|
||||
},{"component-emitter":26,"engine.io-parser":27}],20:[function(_dereq_,module,exports){
|
||||
},{"component-emitter":26,"engine.io-parser":29}],20:[function(_dereq_,module,exports){
|
||||
(function (global){
|
||||
/**
|
||||
* Module dependencies
|
||||
@@ -3908,7 +3850,7 @@ Polling.prototype.uri = function(){
|
||||
return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;
|
||||
};
|
||||
|
||||
},{"../transport":19,"component-inherit":13,"debug":14,"engine.io-parser":27,"parseqs":38,"xmlhttprequest-ssl":25,"yeast":47}],24:[function(_dereq_,module,exports){
|
||||
},{"../transport":19,"component-inherit":13,"debug":14,"engine.io-parser":29,"parseqs":38,"xmlhttprequest-ssl":25,"yeast":46}],24:[function(_dereq_,module,exports){
|
||||
(function (global){
|
||||
/**
|
||||
* Module dependencies.
|
||||
@@ -3920,14 +3862,15 @@ var parseqs = _dereq_('parseqs');
|
||||
var inherit = _dereq_('component-inherit');
|
||||
var yeast = _dereq_('yeast');
|
||||
var debug = _dereq_('debug')('engine.io-client:websocket');
|
||||
var BrowserWebSocket = global.WebSocket || global.MozWebSocket;
|
||||
|
||||
/**
|
||||
* `ws` exposes a WebSocket-compatible interface in
|
||||
* Node, or the `WebSocket` or `MozWebSocket` globals
|
||||
* in the browser.
|
||||
* Get either the `WebSocket` or `MozWebSocket` globals
|
||||
* in the browser or the WebSocket-compatible interface
|
||||
* exposed by `ws` for Node environment.
|
||||
*/
|
||||
|
||||
var WebSocket = _dereq_('ws');
|
||||
var WebSocket = BrowserWebSocket || (typeof window !== 'undefined' ? null : _dereq_('ws'));
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
@@ -4003,7 +3946,7 @@ WS.prototype.doOpen = function(){
|
||||
opts.headers = this.extraHeaders;
|
||||
}
|
||||
|
||||
this.ws = new WebSocket(uri, protocols, opts);
|
||||
this.ws = BrowserWebSocket ? new WebSocket(uri) : new WebSocket(uri, protocols, opts);
|
||||
|
||||
if (this.ws.binaryType === undefined) {
|
||||
this.supportsBinary = false;
|
||||
@@ -4070,15 +4013,13 @@ WS.prototype.write = function(packets){
|
||||
var self = this;
|
||||
this.writable = false;
|
||||
|
||||
var isBrowserWebSocket = global.WebSocket && this.ws instanceof global.WebSocket;
|
||||
|
||||
// encodePacket efficient as it uses WS framing
|
||||
// no need for encodePayload
|
||||
var total = packets.length;
|
||||
for (var i = 0, l = total; i < l; i++) {
|
||||
(function(packet) {
|
||||
parser.encodePacket(packet, self.supportsBinary, function(data) {
|
||||
if (!isBrowserWebSocket) {
|
||||
if (!BrowserWebSocket) {
|
||||
// always create a new object (GH-437)
|
||||
var opts = {};
|
||||
if (packet.options) {
|
||||
@@ -4097,7 +4038,7 @@ WS.prototype.write = function(packets){
|
||||
//have a chance of informing us about it yet, in that case send will
|
||||
//throw an error
|
||||
try {
|
||||
if (isBrowserWebSocket) {
|
||||
if (BrowserWebSocket) {
|
||||
// TypeError is thrown when passing the second argument on Safari
|
||||
self.ws.send(data);
|
||||
} else {
|
||||
@@ -4196,7 +4137,7 @@ WS.prototype.check = function(){
|
||||
};
|
||||
|
||||
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"../transport":19,"component-inherit":13,"debug":14,"engine.io-parser":27,"parseqs":38,"ws":46,"yeast":47}],25:[function(_dereq_,module,exports){
|
||||
},{"../transport":19,"component-inherit":13,"debug":14,"engine.io-parser":29,"parseqs":38,"ws":10,"yeast":46}],25:[function(_dereq_,module,exports){
|
||||
// browser shim for xmlhttprequest module
|
||||
var hasCORS = _dereq_('has-cors');
|
||||
|
||||
@@ -4234,7 +4175,7 @@ module.exports = function(opts) {
|
||||
}
|
||||
}
|
||||
|
||||
},{"has-cors":32}],26:[function(_dereq_,module,exports){
|
||||
},{"has-cors":27}],26:[function(_dereq_,module,exports){
|
||||
|
||||
/**
|
||||
* Expose `Emitter`.
|
||||
@@ -4401,6 +4342,36 @@ Emitter.prototype.hasListeners = function(event){
|
||||
};
|
||||
|
||||
},{}],27:[function(_dereq_,module,exports){
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*
|
||||
* Logic borrowed from Modernizr:
|
||||
*
|
||||
* - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js
|
||||
*/
|
||||
|
||||
try {
|
||||
module.exports = typeof XMLHttpRequest !== 'undefined' &&
|
||||
'withCredentials' in new XMLHttpRequest();
|
||||
} catch (err) {
|
||||
// if XMLHttp support is disabled in IE then it will throw
|
||||
// when trying to create
|
||||
module.exports = false;
|
||||
}
|
||||
|
||||
},{}],28:[function(_dereq_,module,exports){
|
||||
|
||||
var indexOf = [].indexOf;
|
||||
|
||||
module.exports = function(arr, obj){
|
||||
if (indexOf) return arr.indexOf(obj);
|
||||
for (var i = 0; i < arr.length; ++i) {
|
||||
if (arr[i] === obj) return i;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
},{}],29:[function(_dereq_,module,exports){
|
||||
(function (global){
|
||||
/**
|
||||
* Module dependencies.
|
||||
@@ -4998,7 +4969,7 @@ exports.decodePayloadAsBinary = function (data, binaryType, callback) {
|
||||
};
|
||||
|
||||
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"./keys":28,"after":6,"arraybuffer.slice":7,"base64-arraybuffer":9,"blob":10,"has-binary":29,"utf8":45}],28:[function(_dereq_,module,exports){
|
||||
},{"./keys":30,"after":6,"arraybuffer.slice":7,"base64-arraybuffer":31,"blob":9,"has-binary":32,"utf8":45}],30:[function(_dereq_,module,exports){
|
||||
|
||||
/**
|
||||
* Gets the keys for an object.
|
||||
@@ -5019,7 +4990,68 @@ module.exports = Object.keys || function keys (obj){
|
||||
return arr;
|
||||
};
|
||||
|
||||
},{}],29:[function(_dereq_,module,exports){
|
||||
},{}],31:[function(_dereq_,module,exports){
|
||||
/*
|
||||
* base64-arraybuffer
|
||||
* https://github.com/niklasvh/base64-arraybuffer
|
||||
*
|
||||
* Copyright (c) 2012 Niklas von Hertzen
|
||||
* Licensed under the MIT license.
|
||||
*/
|
||||
(function(chars){
|
||||
"use strict";
|
||||
|
||||
exports.encode = function(arraybuffer) {
|
||||
var bytes = new Uint8Array(arraybuffer),
|
||||
i, len = bytes.length, base64 = "";
|
||||
|
||||
for (i = 0; i < len; i+=3) {
|
||||
base64 += chars[bytes[i] >> 2];
|
||||
base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
|
||||
base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
|
||||
base64 += chars[bytes[i + 2] & 63];
|
||||
}
|
||||
|
||||
if ((len % 3) === 2) {
|
||||
base64 = base64.substring(0, base64.length - 1) + "=";
|
||||
} else if (len % 3 === 1) {
|
||||
base64 = base64.substring(0, base64.length - 2) + "==";
|
||||
}
|
||||
|
||||
return base64;
|
||||
};
|
||||
|
||||
exports.decode = function(base64) {
|
||||
var bufferLength = base64.length * 0.75,
|
||||
len = base64.length, i, p = 0,
|
||||
encoded1, encoded2, encoded3, encoded4;
|
||||
|
||||
if (base64[base64.length - 1] === "=") {
|
||||
bufferLength--;
|
||||
if (base64[base64.length - 2] === "=") {
|
||||
bufferLength--;
|
||||
}
|
||||
}
|
||||
|
||||
var arraybuffer = new ArrayBuffer(bufferLength),
|
||||
bytes = new Uint8Array(arraybuffer);
|
||||
|
||||
for (i = 0; i < len; i+=4) {
|
||||
encoded1 = chars.indexOf(base64[i]);
|
||||
encoded2 = chars.indexOf(base64[i+1]);
|
||||
encoded3 = chars.indexOf(base64[i+2]);
|
||||
encoded4 = chars.indexOf(base64[i+3]);
|
||||
|
||||
bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
|
||||
bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
|
||||
bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
|
||||
}
|
||||
|
||||
return arraybuffer;
|
||||
};
|
||||
})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");
|
||||
|
||||
},{}],32:[function(_dereq_,module,exports){
|
||||
(function (global){
|
||||
|
||||
/*
|
||||
@@ -5081,17 +5113,7 @@ function hasBinary(data) {
|
||||
}
|
||||
|
||||
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"isarray":34}],30:[function(_dereq_,module,exports){
|
||||
|
||||
/**
|
||||
* Returns `this`. Execute this without a "context" (i.e. without it being
|
||||
* attached to an object of the left-hand side), and `this` points to the
|
||||
* "global" scope of the current JS execution.
|
||||
*/
|
||||
|
||||
module.exports = (function () { return this; })();
|
||||
|
||||
},{}],31:[function(_dereq_,module,exports){
|
||||
},{"isarray":34}],33:[function(_dereq_,module,exports){
|
||||
(function (global){
|
||||
|
||||
/*
|
||||
@@ -5154,43 +5176,7 @@ function hasBinary(data) {
|
||||
}
|
||||
|
||||
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"isarray":34}],32:[function(_dereq_,module,exports){
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var global = _dereq_('global');
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*
|
||||
* Logic borrowed from Modernizr:
|
||||
*
|
||||
* - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js
|
||||
*/
|
||||
|
||||
try {
|
||||
module.exports = 'XMLHttpRequest' in global &&
|
||||
'withCredentials' in new global.XMLHttpRequest();
|
||||
} catch (err) {
|
||||
// if XMLHttp support is disabled in IE then it will throw
|
||||
// when trying to create
|
||||
module.exports = false;
|
||||
}
|
||||
|
||||
},{"global":30}],33:[function(_dereq_,module,exports){
|
||||
|
||||
var indexOf = [].indexOf;
|
||||
|
||||
module.exports = function(arr, obj){
|
||||
if (indexOf) return arr.indexOf(obj);
|
||||
for (var i = 0; i < arr.length; ++i) {
|
||||
if (arr[i] === obj) return i;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
},{}],34:[function(_dereq_,module,exports){
|
||||
},{"isarray":34}],34:[function(_dereq_,module,exports){
|
||||
module.exports = Array.isArray || function (arr) {
|
||||
return Object.prototype.toString.call(arr) == '[object Array]';
|
||||
};
|
||||
@@ -6908,8 +6894,8 @@ function isBuf(obj) {
|
||||
|
||||
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{}],43:[function(_dereq_,module,exports){
|
||||
module.exports=_dereq_(26)
|
||||
},{}],44:[function(_dereq_,module,exports){
|
||||
arguments[4][26][0].apply(exports,arguments)
|
||||
},{"dup":26}],44:[function(_dereq_,module,exports){
|
||||
module.exports = toArray
|
||||
|
||||
function toArray(list, index) {
|
||||
@@ -7173,51 +7159,6 @@ function toArray(list, index) {
|
||||
|
||||
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{}],46:[function(_dereq_,module,exports){
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var global = (function() { return this; })();
|
||||
|
||||
/**
|
||||
* WebSocket constructor.
|
||||
*/
|
||||
|
||||
var WebSocket = global.WebSocket || global.MozWebSocket;
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = WebSocket ? ws : null;
|
||||
|
||||
/**
|
||||
* WebSocket constructor.
|
||||
*
|
||||
* The third `opts` options object gets ignored in web browsers, since it's
|
||||
* non-standard, and throws a TypeError if passed to the constructor.
|
||||
* See: https://github.com/einaros/ws/issues/227
|
||||
*
|
||||
* @param {String} uri
|
||||
* @param {Array} protocols (optional)
|
||||
* @param {Object) opts (optional)
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function ws(uri, protocols, opts) {
|
||||
var instance;
|
||||
if (protocols) {
|
||||
instance = new WebSocket(uri, protocols);
|
||||
} else {
|
||||
instance = new WebSocket(uri);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
if (WebSocket) ws.prototype = WebSocket.prototype;
|
||||
|
||||
},{}],47:[function(_dereq_,module,exports){
|
||||
'use strict';
|
||||
|
||||
var alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('')
|
||||
@@ -7287,6 +7228,7 @@ yeast.encode = encode;
|
||||
yeast.decode = decode;
|
||||
module.exports = yeast;
|
||||
|
||||
},{}]},{},[1])
|
||||
(1)
|
||||
},{}],47:[function(_dereq_,module,exports){
|
||||
arguments[4][28][0].apply(exports,arguments)
|
||||
},{"dup":28}]},{},[1])(1)
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user