Template Upload
This commit is contained in:
492
node_modules/socket.io-client/History.md
generated
vendored
Normal file
492
node_modules/socket.io-client/History.md
generated
vendored
Normal file
@ -0,0 +1,492 @@
|
||||
|
||||
1.6.0 / 2016-11-20
|
||||
==================
|
||||
|
||||
* [feature] emit sourcemap for socket.io.js (#953)
|
||||
* [feature] Support minified `socket.io.min.js` (#1021)
|
||||
* [chore] Bump dependencies (#1026)
|
||||
|
||||
1.5.1 / 2016-10-24
|
||||
==================
|
||||
|
||||
* [chore] Disable AMD for json3 (#1005)
|
||||
* [chore] Bump socket.io-parser to 2.3.0 (#1009)
|
||||
* [chore] Bump engine.io-client to 1.7.1 (#1010)
|
||||
* [chore] Update zuul browser settings (#1011)
|
||||
* [chore] Add Github issue and PR templates (#1013)
|
||||
* [chore] Bump engine.io-client to 1.7.2 and socket.io-parser to 2.3.1 (#1015)
|
||||
|
||||
1.5.0 / 2016-10-06
|
||||
==================
|
||||
|
||||
* [fix] Fix query string management (#943)
|
||||
* [chore] Add gulp & babel in the build process (#940)
|
||||
* [chore] Add eslint (#951)
|
||||
* [chore] bump zuul (#958)
|
||||
* [chore] Remove jspm browser config (#957)
|
||||
* [chore] Update zuul browser settings following EOL notices (#985)
|
||||
* [chore] Bump zuul to 3.11.0 & zuul-ngrok to 4.0.0 (#997)
|
||||
* [chore] reference build badge to master branch (#967)
|
||||
* [chore] Bump engine.io-client to 1.7.0 (#996)
|
||||
* [chore] Restrict files included in npm package (#998)
|
||||
|
||||
1.4.8 / 2016-06-23
|
||||
==================
|
||||
|
||||
* package: bump `engine.io-client`
|
||||
|
||||
1.4.7 / 2016-06-23
|
||||
==================
|
||||
|
||||
* bump engine.io-client
|
||||
|
||||
1.4.6 / 2016-05-02
|
||||
==================
|
||||
|
||||
* bump engine.io-client
|
||||
|
||||
1.4.5 / 2016-01-26
|
||||
==================
|
||||
|
||||
* fix `NativeScript` support
|
||||
|
||||
1.4.4 / 2016-01-10
|
||||
==================
|
||||
|
||||
* bump `engine.io-client`
|
||||
|
||||
1.4.3 / 2016-01-08
|
||||
==================
|
||||
|
||||
* remove `webpack.config.js`
|
||||
|
||||
1.4.2 / 2016-01-07
|
||||
==================
|
||||
|
||||
* exclude `ws` instead of `ignore`ing it from build [@lpinca]
|
||||
* add global object as another fallback [@ligaz]
|
||||
* bump `engine.io-client`
|
||||
|
||||
1.4.1 / 2016-01-07
|
||||
==================
|
||||
|
||||
* package: bump `engine.io-client`
|
||||
|
||||
1.4.0 / 2015-11-28
|
||||
==================
|
||||
|
||||
* package: bump `engine.io-client`
|
||||
* manager: fix `Object.prototype` extensions
|
||||
* package: bump `zuul` and `zuul-ngrok`
|
||||
* package: bump `debug`
|
||||
* package: bump `socket.io-parser`
|
||||
* package: bump `has-binary`
|
||||
* remove unnecessary `index.js`
|
||||
* added support for `ping` and `pong` events
|
||||
* proper handling of disconnection while in `opening` state
|
||||
* instrumentation / style tweaks
|
||||
* added tests for same-namespace new connection handling
|
||||
* do not call apply if packet id is not in acks
|
||||
* build sio client with make to autogenerate new socket.io.js
|
||||
* bugfix/1956 don't reuse same-namespace connections #2
|
||||
* fix has-binary to work with all objects [gunta]
|
||||
* bugfix/1956 don't reuse same-namespace connections
|
||||
* add support for compression [nkzawa]
|
||||
* fix: location.port was ignored
|
||||
|
||||
1.3.7 / 2015-09-21
|
||||
==================
|
||||
|
||||
* package: bump `socket.io` for node4 support
|
||||
* package: bump `engine.io-client` for node4 compatibility
|
||||
|
||||
1.3.6 / 2015-07-14
|
||||
==================
|
||||
|
||||
* package: bump `engine.io-client` to fix build on windows
|
||||
|
||||
1.3.5 / 2015-03-03
|
||||
==================
|
||||
|
||||
* package: bump parser
|
||||
|
||||
1.3.4 / 2015-02-14
|
||||
==================
|
||||
|
||||
* build `socket.io.js` with `engine.io-client` `1.5.1`
|
||||
|
||||
1.3.3 / 2015-02-03
|
||||
==================
|
||||
|
||||
* package: bump parser
|
||||
|
||||
1.3.2 / 2015-01-19
|
||||
==================
|
||||
|
||||
* build `socket.io.js`
|
||||
|
||||
1.3.1 / 2015-01-19
|
||||
==================
|
||||
|
||||
* no change on this release
|
||||
* package: bump `engine.io-client` to not depend on `git(1)` for a dep
|
||||
|
||||
1.3.0 / 2015-01-19
|
||||
==================
|
||||
|
||||
* package: bump `engine.io-client`
|
||||
* added `socket.id` property pointing to session id [rase-]
|
||||
* fix url parsing when uri string is undefined [defunctzombie]
|
||||
* implemented `backo` for exponential backoff with randomization [mokesmokes]
|
||||
* reset reconnection attempts state after a successul connection [mokesmokes]
|
||||
|
||||
1.2.1 / 2014-11-21
|
||||
==================
|
||||
|
||||
* package: bump `engine.io-client`
|
||||
* README: fixes to prevent duplicate events [nkzawa]
|
||||
* fix reconnection after reconnecting manually [nkzawa]
|
||||
* make ACK callbacks idempotent [thexeos]
|
||||
* package: bump `uglify-js`
|
||||
|
||||
1.2.0 / 2014-10-27
|
||||
==================
|
||||
|
||||
* bump `engine.io-client`.
|
||||
* set `readyState` before engine.io close event
|
||||
* fix reconnection after reconnecting manually
|
||||
* enable to stop reconnecting
|
||||
* downloads badge
|
||||
* support no schema relative url
|
||||
* enable to reconnect manually
|
||||
|
||||
1.1.0 / 2014-09-04
|
||||
==================
|
||||
|
||||
* socket: fix in `has-binary`
|
||||
* package: bump `socket.io-parser`
|
||||
* package: bump `engine.io-client`
|
||||
* further increase test timeout.
|
||||
* double to singly quotes in tests.
|
||||
* extend timeout and remember to close everything in each test case
|
||||
* fix travis
|
||||
* add travis + zuul matrix
|
||||
* use svg instead of png to get better image quality in readme
|
||||
* make CI build faster
|
||||
* removed unnecessary code from try block. Only decode packet is needed.
|
||||
* package: bump `browserify`
|
||||
* package: bump `engine.io-client`
|
||||
* fix autoConnect option
|
||||
* npmignore: ignore `.gitignore`
|
||||
* package: update `browserify`
|
||||
* don't fire an extra reconnect when we're not reconnecting
|
||||
after a failed initial connect attempt
|
||||
* package: bump `socket.io-parser` for `component-emitter` dep fix
|
||||
* updated tests to reflect `autoConnect` option
|
||||
* add `autoConnect` option to wait with connecting
|
||||
|
||||
1.0.6 / 2014-06-19
|
||||
==================
|
||||
|
||||
* test fixes on internet explorer
|
||||
* fixes for duplicate event propagation from manager instance [Rase-]
|
||||
|
||||
1.0.5 / 2014-06-16
|
||||
==================
|
||||
|
||||
* package: bump `engine.io-client` for better deps and smaller build
|
||||
* handle io.connect(null, opts) correctly [audreyt]
|
||||
* url: fix incorrect ports in certain connections [holic]
|
||||
* manager: propagate all reconnection events to sockets [Rase-]
|
||||
* index: added BC for `force new connection`
|
||||
* socket: fix event buffering while in disconnected state [kevin-roark]
|
||||
* package: stop using tarballs in dependencies [reid]
|
||||
* manager: relay `connect_error` and `connect_timeout` to sockets
|
||||
|
||||
1.0.4 / 2014-06-02
|
||||
==================
|
||||
|
||||
* update build
|
||||
|
||||
1.0.3 / 2014-05-31
|
||||
==================
|
||||
|
||||
* package; bump `socket.io-parser` for binary ACK fix
|
||||
* package: bump `engine.io-client` for binary UTF8 fix
|
||||
|
||||
1.0.2 / 2014-05-28
|
||||
==================
|
||||
|
||||
* package: bump `socket.io-parser` for windows fix
|
||||
|
||||
1.0.1 / 2014-05-28
|
||||
==================
|
||||
|
||||
* override npm tag
|
||||
|
||||
1.0.0 / 2014-05-28
|
||||
==================
|
||||
|
||||
* stable release
|
||||
|
||||
1.0.0-pre5 / 2014-05-22
|
||||
=======================
|
||||
|
||||
* package: bump `engine.io-client` for parser fixes
|
||||
|
||||
1.0.0-pre4 / 2014-05-19
|
||||
=======================
|
||||
|
||||
* build
|
||||
|
||||
1.0.0-pre3 / 2014-05-17
|
||||
=======================
|
||||
|
||||
* package: bump parser
|
||||
* package: bump engine.io-client
|
||||
|
||||
1.0.0-pre2 / 2014-04-27
|
||||
=======================
|
||||
|
||||
* package: bump `engine.io-client`
|
||||
* package: bump `zuul`
|
||||
* allows user-level query string parameters to be in socket.request
|
||||
* package: bump `socket.io-parser`
|
||||
* package: bump `engine.io-client` for android fix
|
||||
* tidy up .gitignore
|
||||
|
||||
1.0.0-pre / 2014-03-14
|
||||
======================
|
||||
|
||||
* implemented `engine.io-client`
|
||||
* implemented `socket.io-parser`
|
||||
* implemented `json3` to avoid env pollution
|
||||
* implemented `debug`
|
||||
* added binary support
|
||||
* added `browserify` support
|
||||
|
||||
0.9.11 / 2012-11-02
|
||||
===================
|
||||
|
||||
* Enable use of 'xhr' transport in Node.js
|
||||
* Fix the problem with disconnecting xhr-polling users
|
||||
* Add should to devDependencies
|
||||
* Prefer XmlHttpRequest if CORS is available
|
||||
* Make client compatible with AMD loaders.
|
||||
|
||||
0.9.10 / 2012-08-10
|
||||
===================
|
||||
|
||||
* fix removeAllListeners to behave as expected.
|
||||
* set withCredentials to true only if xdomain.
|
||||
* socket: disable disconnect on unload by default.
|
||||
|
||||
0.9.9 / 2012-08-01
|
||||
==================
|
||||
|
||||
* socket: fixed disconnect xhr url and made it actually sync
|
||||
* *: bump xmlhttprequest dep
|
||||
|
||||
0.9.8 / 2012-07-24
|
||||
==================
|
||||
|
||||
* Fixed build.
|
||||
|
||||
0.9.7 / 2012-07-24
|
||||
==================
|
||||
|
||||
* iOS websocket crash fix.
|
||||
* Fixed potential `open` collision.
|
||||
* Fixed disconnectSync.
|
||||
|
||||
0.9.6 / 2012-04-17
|
||||
==================
|
||||
|
||||
* Don't position the jsonp form off the screen (android fix).
|
||||
|
||||
0.9.5 / 2012-04-05
|
||||
==================
|
||||
|
||||
* Bumped version.
|
||||
|
||||
0.9.4 / 2012-04-01
|
||||
==================
|
||||
|
||||
* Fixes polling loop upon reconnect advice (fixes #438).
|
||||
|
||||
0.9.3 / 2012-03-28
|
||||
==================
|
||||
|
||||
* Fix XHR.check, which was throwing an error transparently and causing non-IE browsers to fall back to JSONP [mikito]
|
||||
* Fixed forced disconnect on window close [zzzaaa]
|
||||
|
||||
0.9.2 / 2012-03-13
|
||||
==================
|
||||
|
||||
* Transport order set by "options" [zzzaaa]
|
||||
|
||||
0.9.1-1 / 2012-03-02
|
||||
====================
|
||||
|
||||
* Fixed active-x-obfuscator NPM dependency.
|
||||
|
||||
0.9.1 / 2012-03-02
|
||||
==================
|
||||
|
||||
* Misc corrections.
|
||||
* Added warning within Firefox about webworker test in test runner.
|
||||
* Update ws dependency [einaros]
|
||||
* Implemented client side heartbeat checks. [felixge]
|
||||
* Improved Firewall support with ActiveX obfuscation. [felixge]
|
||||
* Fixed error handling during connection process. [Outsideris]
|
||||
|
||||
0.9.0 / 2012-02-26
|
||||
==================
|
||||
|
||||
* Added DS_Store to gitignore.
|
||||
* Updated depedencies.
|
||||
* Bumped uglify
|
||||
* Tweaking code so it doesn't throw an exception when used inside a WebWorker in Firefox
|
||||
* Do not rely on Array.prototype.indexOf as it breaks with pages that use the Prototype.js library.
|
||||
* Windows support landed
|
||||
* Use @einaros ws module instead of the old crap one
|
||||
* Fix for broken closeTimeout and 'IE + xhr' goes into infinite loop on disconnection
|
||||
* Disabled reconnection on error if reconnect option is set to false
|
||||
* Set withCredentials to true before xhr to fix authentication
|
||||
* Clears the timeout from reconnection attempt when there is a successful or failed reconnection.
|
||||
This fixes the issue of setTimeout's carrying over from previous reconnection
|
||||
and changing (skipping) values of self.reconnectionDelay in the newer reconnection.
|
||||
* Removed decoding of parameters when chunking the query string.
|
||||
This was used later on to construct the url to post to the socket.io server
|
||||
for connection and if we're adding custom parameters of our own to this url
|
||||
(for example for OAuth authentication) they were being sent decoded, which is wrong.
|
||||
|
||||
0.8.7 / 2011-11-05
|
||||
==================
|
||||
|
||||
* Bumped client
|
||||
|
||||
0.8.6 / 2011-10-27
|
||||
==================
|
||||
|
||||
* Added WebWorker support.
|
||||
* Fixed swfobject and web_socket.js to not assume window.
|
||||
* Fixed CORS detection for webworker.
|
||||
* Fix `defer` for webkit in a webworker.
|
||||
* Fixed io.util.request to not rely on window.
|
||||
* FIxed; use global instead of window and dont rely on document.
|
||||
* Fixed; JSON-P handshake if CORS is not available.
|
||||
* Made underlying Transport disconnection trigger immediate socket.io disconnect.
|
||||
* Fixed warning when compressing with Google Closure Compiler.
|
||||
* Fixed builder's uglify utf-8 support.
|
||||
* Added workaround for loading indicator in FF jsonp-polling. [3rd-Eden]
|
||||
* Fixed host discovery lookup. [holic]
|
||||
* Fixed close timeout when disconnected/reconnecting. [jscharlach]
|
||||
* Fixed jsonp-polling feature detection.
|
||||
* Fixed jsonp-polling client POSTing of \n.
|
||||
* Fixed test runner on IE6/7
|
||||
|
||||
0.8.5 / 2011-10-07
|
||||
==================
|
||||
|
||||
* Bumped client
|
||||
|
||||
0.8.4 / 2011-09-06
|
||||
==================
|
||||
|
||||
* Corrected build
|
||||
|
||||
0.8.3 / 2011-09-03
|
||||
==================
|
||||
|
||||
* Fixed `\n` parsing for non-JSON packets.
|
||||
* Fixed; make Socket.IO XHTML doctype compatible (fixes #460 from server)
|
||||
* Fixed support for Node.JS running `socket.io-client`.
|
||||
* Updated repository name in `package.json`.
|
||||
* Added support for different policy file ports without having to port
|
||||
forward 843 on the server side [3rd-Eden]
|
||||
|
||||
0.8.2 / 2011-08-29
|
||||
==================
|
||||
|
||||
* Fixed flashsocket detection.
|
||||
|
||||
0.8.1 / 2011-08-29
|
||||
==================
|
||||
|
||||
* Bump version.
|
||||
|
||||
0.8.0 / 2011-08-28
|
||||
==================
|
||||
|
||||
* Added MozWebSocket support (hybi-10 doesn't require API changes) [einaros].
|
||||
|
||||
0.7.11 / 2011-08-27
|
||||
===================
|
||||
|
||||
* Corrected previous release (missing build).
|
||||
|
||||
0.7.10 / 2011-08-27
|
||||
===================
|
||||
|
||||
* Fix for failing fallback in websockets
|
||||
|
||||
0.7.9 / 2011-08-12
|
||||
==================
|
||||
|
||||
* Added check on `Socket#onConnect` to prevent double `connect` events on the main manager.
|
||||
* Fixed socket namespace connect test. Remove broken alternative namespace connect test.
|
||||
* Removed test handler for removed test.
|
||||
* Bumped version to match `socket.io` server.
|
||||
|
||||
0.7.5 / 2011-08-08
|
||||
==================
|
||||
|
||||
* Added querystring support for `connect` [3rd-Eden]
|
||||
* Added partial Node.JS transports support [3rd-Eden, josephg]
|
||||
* Fixed builder test.
|
||||
* Changed `util.inherit` to replicate Object.create / __proto__.
|
||||
* Changed and cleaned up some acceptance tests.
|
||||
* Fixed race condition with a test that could not be run multiple times.
|
||||
* Added test for encoding a payload.
|
||||
* Added the ability to override the transport to use in acceptance test [3rd-Eden]
|
||||
* Fixed multiple connect packets [DanielBaulig]
|
||||
* Fixed jsonp-polling over-buffering [3rd-Eden]
|
||||
* Fixed ascii preservation in minified socket.io client [3rd-Eden]
|
||||
* Fixed socket.io in situations where the page is not served through utf8.
|
||||
* Fixed namespaces not reconnecting after disconnect [3rd-Eden]
|
||||
* Fixed default port for secure connections.
|
||||
|
||||
0.7.4 / 2011-07-12
|
||||
==================
|
||||
|
||||
* Added `SocketNamespace#of` shortcut. [3rd-Eden]
|
||||
* Fixed a IE payload decoding bug. [3rd-Eden]
|
||||
* Honor document protocol, unless overriden. [dvv]
|
||||
* Fixed new builder dependencies. [3rd-Eden]
|
||||
|
||||
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
|
||||
==================
|
||||
|
||||
* Added `noop` message type.
|
||||
|
||||
0.7.1 / 2011-06-21
|
||||
==================
|
||||
|
||||
* Bumped socket.io dependency version for acceptance tests.
|
||||
|
||||
0.7.0 / 2011-06-21
|
||||
==================
|
||||
|
||||
* http://socket.io/announcement.html
|
||||
|
22
node_modules/socket.io-client/LICENSE
generated
vendored
Normal file
22
node_modules/socket.io-client/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Guillermo Rauch
|
||||
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
188
node_modules/socket.io-client/README.md
generated
vendored
Normal file
188
node_modules/socket.io-client/README.md
generated
vendored
Normal file
@ -0,0 +1,188 @@
|
||||
|
||||
# socket.io-client
|
||||
|
||||
[](http://travis-ci.org/socketio/socket.io-client)
|
||||
[](https://david-dm.org/socketio/socket.io-client)
|
||||
[](https://david-dm.org/socketio/socket.io-client#info=devDependencies)
|
||||

|
||||

|
||||
[](http://slack.socket.io)
|
||||
|
||||
## How to use
|
||||
|
||||
A standalone build of `socket.io-client` is exposed automatically by the
|
||||
socket.io server as `/socket.io/socket.io.js`. Alternatively you can
|
||||
serve the file `socket.io.js` or `socket.io.min.js` found at the root of this repository.
|
||||
|
||||
```html
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script>
|
||||
var socket = io('http://localhost');
|
||||
socket.on('connect', function(){});
|
||||
socket.on('event', function(data){});
|
||||
socket.on('disconnect', function(){});
|
||||
</script>
|
||||
```
|
||||
|
||||
Socket.IO is compatible with [browserify](http://browserify.org/).
|
||||
|
||||
### Node.JS (server-side usage)
|
||||
|
||||
Add `socket.io-client` to your `package.json` and then:
|
||||
|
||||
```js
|
||||
var socket = require('socket.io-client')('http://localhost');
|
||||
socket.on('connect', function(){});
|
||||
socket.on('event', function(data){});
|
||||
socket.on('disconnect', function(){});
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### IO(url:String, opts:Object):Socket
|
||||
|
||||
Exposed as the `io` namespace in the standalone build, or the result
|
||||
of calling `require('socket.io-client')`.
|
||||
|
||||
When called, it creates a new `Manager` for the given URL, and attempts
|
||||
to reuse an existing `Manager` for subsequent calls, unless the
|
||||
`multiplex` option is passed with `false`.
|
||||
|
||||
The rest of the options are passed to the `Manager` constructor (see below
|
||||
for details).
|
||||
|
||||
A `Socket` instance is returned for the namespace specified by the
|
||||
pathname in the URL, defaulting to `/`. For example, if the `url` is
|
||||
`http://localhost/users`, a transport connection will be established to
|
||||
`http://localhost` and a Socket.IO connection will be established to
|
||||
`/users`.
|
||||
|
||||
### IO#protocol
|
||||
|
||||
Socket.io protocol revision number this client works with.
|
||||
|
||||
### IO#Socket
|
||||
|
||||
Reference to the `Socket` constructor.
|
||||
|
||||
### IO#Manager
|
||||
|
||||
Reference to the `Manager` constructor.
|
||||
|
||||
### IO#Emitter
|
||||
|
||||
Reference to the `Emitter` constructor.
|
||||
|
||||
### Manager(url:String, opts:Object)
|
||||
|
||||
A `Manager` represents a connection to a given Socket.IO server. One or
|
||||
more `Socket` instances are associated with the manager. The manager
|
||||
can be accessed through the `io` property of each `Socket` instance.
|
||||
|
||||
The `opts` are also passed to `engine.io` upon initialization of the
|
||||
underlying `Socket`.
|
||||
|
||||
Options:
|
||||
- `reconnection` whether to reconnect automatically (`true`)
|
||||
- `reconnectionAttempts` (`Infinity`) before giving up
|
||||
- `reconnectionDelay` how long to initially wait before attempting a new
|
||||
reconnection (`1000`). Affected by +/- `randomizationFactor`,
|
||||
for example the default initial delay will be between 500 to 1500ms.
|
||||
- `reconnectionDelayMax` maximum amount of time to wait between
|
||||
reconnections (`5000`). Each attempt increases the reconnection delay by 2x
|
||||
along with a randomization as above
|
||||
- `randomizationFactor` (`0.5`), 0 <= randomizationFactor <= 1
|
||||
- `timeout` connection timeout before a `connect_error`
|
||||
and `connect_timeout` events are emitted (`20000`)
|
||||
- `autoConnect` by setting this false, you have to call `manager.open`
|
||||
whenever you decide it's appropriate
|
||||
|
||||
#### Events
|
||||
|
||||
- `connect_error`. Fired upon a connection error.
|
||||
Parameters:
|
||||
- `Object` error object
|
||||
- `connect_timeout`. Fired upon a connection timeout.
|
||||
- `reconnect`. Fired upon a successful reconnection.
|
||||
Parameters:
|
||||
- `Number` reconnection attempt number
|
||||
- `reconnect_attempt`. Fired upon an attempt to reconnect.
|
||||
- `reconnecting`. Fired upon an attempt to reconnect.
|
||||
Parameters:
|
||||
- `Number` reconnection attempt number
|
||||
- `reconnect_error`. Fired upon a reconnection attempt error.
|
||||
Parameters:
|
||||
- `Object` error object
|
||||
- `reconnect_failed`. Fired when couldn't reconnect within `reconnectionAttempts`
|
||||
- `ping`. Fired when a ping packet is written out to the server.
|
||||
- `pong`. Fired when a pong is received from the server.
|
||||
Parameters:
|
||||
- `Number` number of ms elapsed since `ping` packet (i.e.: latency).
|
||||
|
||||
The events above are also emitted on the individual sockets that
|
||||
reconnect that depend on this `Manager`.
|
||||
|
||||
### Manager#reconnection(v:Boolean):Manager
|
||||
|
||||
Sets the `reconnection` option, or returns it if no parameters
|
||||
are passed.
|
||||
|
||||
### Manager#reconnectionAttempts(v:Boolean):Manager
|
||||
|
||||
Sets the `reconnectionAttempts` option, or returns it if no parameters
|
||||
are passed.
|
||||
|
||||
### Manager#reconnectionDelay(v:Boolean):Manager
|
||||
|
||||
Sets the `reconectionDelay` option, or returns it if no parameters
|
||||
are passed.
|
||||
|
||||
### Manager#reconnectionDelayMax(v:Boolean):Manager
|
||||
|
||||
Sets the `reconectionDelayMax` option, or returns it if no parameters
|
||||
are passed.
|
||||
|
||||
### Manager#timeout(v:Boolean):Manager
|
||||
|
||||
Sets the `timeout` option, or returns it if no parameters
|
||||
are passed.
|
||||
|
||||
### Socket
|
||||
|
||||
#### Socket#id:String
|
||||
|
||||
A property on the `socket` instance that is equal to the underlying engine.io socket id.
|
||||
|
||||
The property is present once the socket has connected, is removed when the socket disconnects and is updated if the socket reconnects.
|
||||
|
||||
#### Socket#compress(v:Boolean):Socket
|
||||
|
||||
Sets a modifier for a subsequent event emission that the event data will
|
||||
only be _compressed_ if the value is `true`. Defaults to `true` when you don't call the method.
|
||||
|
||||
```js
|
||||
socket.compress(false).emit('an event', { some: 'data' });
|
||||
```
|
||||
|
||||
#### Events
|
||||
|
||||
- `connect`. Fired upon a connection including a successful reconnection.
|
||||
- `error`. Fired upon a connection error
|
||||
Parameters:
|
||||
- `Object` error data
|
||||
- `disconnect`. Fired upon a disconnection.
|
||||
- `reconnect`. Fired upon a successful reconnection.
|
||||
Parameters:
|
||||
- `Number` reconnection attempt number
|
||||
- `reconnect_attempt`. Fired upon an attempt to reconnect.
|
||||
- `reconnecting`. Fired upon an attempt to reconnect.
|
||||
Parameters:
|
||||
- `Number` reconnection attempt number
|
||||
- `reconnect_error`. Fired upon a reconnection attempt error.
|
||||
Parameters:
|
||||
- `Object` error object
|
||||
- `reconnect_failed`. Fired when couldn't reconnect within `reconnectionAttempts`
|
||||
|
||||
## License
|
||||
|
||||
[MIT](/LICENSE)
|
109
node_modules/socket.io-client/lib/index.js
generated
vendored
Normal file
109
node_modules/socket.io-client/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var url = require('./url');
|
||||
var parser = require('socket.io-parser');
|
||||
var Manager = require('./manager');
|
||||
var debug = require('debug')('socket.io-client');
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = exports = lookup;
|
||||
|
||||
/**
|
||||
* Managers cache.
|
||||
*/
|
||||
|
||||
var cache = exports.managers = {};
|
||||
|
||||
/**
|
||||
* Looks up an existing `Manager` for multiplexing.
|
||||
* If the user summons:
|
||||
*
|
||||
* `io('http://localhost/a');`
|
||||
* `io('http://localhost/b');`
|
||||
*
|
||||
* We reuse the existing instance based on same scheme/port/host,
|
||||
* and we initialize sockets for each namespace.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function lookup (uri, opts) {
|
||||
if (typeof uri === 'object') {
|
||||
opts = uri;
|
||||
uri = undefined;
|
||||
}
|
||||
|
||||
opts = opts || {};
|
||||
|
||||
var parsed = url(uri);
|
||||
var source = parsed.source;
|
||||
var id = parsed.id;
|
||||
var path = parsed.path;
|
||||
var sameNamespace = cache[id] && path in cache[id].nsps;
|
||||
var newConnection = opts.forceNew || opts['force new connection'] ||
|
||||
false === opts.multiplex || sameNamespace;
|
||||
|
||||
var io;
|
||||
|
||||
if (newConnection) {
|
||||
debug('ignoring socket cache for %s', source);
|
||||
io = Manager(source, opts);
|
||||
} else {
|
||||
if (!cache[id]) {
|
||||
debug('new io instance for %s', source);
|
||||
cache[id] = Manager(source, opts);
|
||||
}
|
||||
io = cache[id];
|
||||
}
|
||||
if (parsed.query && !opts.query) {
|
||||
opts.query = parsed.query;
|
||||
} else if (opts && 'object' === typeof opts.query) {
|
||||
opts.query = encodeQueryString(opts.query);
|
||||
}
|
||||
return io.socket(parsed.path, opts);
|
||||
}
|
||||
/**
|
||||
* Helper method to parse query objects to string.
|
||||
* @param {object} query
|
||||
* @returns {string}
|
||||
*/
|
||||
function encodeQueryString (obj) {
|
||||
var str = [];
|
||||
for (var p in obj) {
|
||||
if (obj.hasOwnProperty(p)) {
|
||||
str.push(encodeURIComponent(p) + '=' + encodeURIComponent(obj[p]));
|
||||
}
|
||||
}
|
||||
return str.join('&');
|
||||
}
|
||||
/**
|
||||
* Protocol version.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.protocol = parser.protocol;
|
||||
|
||||
/**
|
||||
* `connect`.
|
||||
*
|
||||
* @param {String} uri
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.connect = lookup;
|
||||
|
||||
/**
|
||||
* Expose constructors for standalone build.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.Manager = require('./manager');
|
||||
exports.Socket = require('./socket');
|
560
node_modules/socket.io-client/lib/manager.js
generated
vendored
Normal file
560
node_modules/socket.io-client/lib/manager.js
generated
vendored
Normal file
@ -0,0 +1,560 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var eio = require('engine.io-client');
|
||||
var Socket = require('./socket');
|
||||
var Emitter = require('component-emitter');
|
||||
var parser = require('socket.io-parser');
|
||||
var on = require('./on');
|
||||
var bind = require('component-bind');
|
||||
var debug = require('debug')('socket.io-client:manager');
|
||||
var indexOf = require('indexof');
|
||||
var Backoff = require('backo2');
|
||||
|
||||
/**
|
||||
* IE6+ hasOwnProperty
|
||||
*/
|
||||
|
||||
var has = Object.prototype.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Module exports
|
||||
*/
|
||||
|
||||
module.exports = Manager;
|
||||
|
||||
/**
|
||||
* `Manager` constructor.
|
||||
*
|
||||
* @param {String} engine instance or engine uri/opts
|
||||
* @param {Object} options
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Manager (uri, opts) {
|
||||
if (!(this instanceof Manager)) return new Manager(uri, opts);
|
||||
if (uri && ('object' === typeof uri)) {
|
||||
opts = uri;
|
||||
uri = undefined;
|
||||
}
|
||||
opts = opts || {};
|
||||
|
||||
opts.path = opts.path || '/socket.io';
|
||||
this.nsps = {};
|
||||
this.subs = [];
|
||||
this.opts = opts;
|
||||
this.reconnection(opts.reconnection !== false);
|
||||
this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);
|
||||
this.reconnectionDelay(opts.reconnectionDelay || 1000);
|
||||
this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);
|
||||
this.randomizationFactor(opts.randomizationFactor || 0.5);
|
||||
this.backoff = new Backoff({
|
||||
min: this.reconnectionDelay(),
|
||||
max: this.reconnectionDelayMax(),
|
||||
jitter: this.randomizationFactor()
|
||||
});
|
||||
this.timeout(null == opts.timeout ? 20000 : opts.timeout);
|
||||
this.readyState = 'closed';
|
||||
this.uri = uri;
|
||||
this.connecting = [];
|
||||
this.lastPing = null;
|
||||
this.encoding = false;
|
||||
this.packetBuffer = [];
|
||||
this.encoder = new parser.Encoder();
|
||||
this.decoder = new parser.Decoder();
|
||||
this.autoConnect = opts.autoConnect !== false;
|
||||
if (this.autoConnect) this.open();
|
||||
}
|
||||
|
||||
/**
|
||||
* Propagate given event to sockets and emit on `this`
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Manager.prototype.emitAll = function () {
|
||||
this.emit.apply(this, arguments);
|
||||
for (var nsp in this.nsps) {
|
||||
if (has.call(this.nsps, nsp)) {
|
||||
this.nsps[nsp].emit.apply(this.nsps[nsp], arguments);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Update `socket.id` of all sockets
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Manager.prototype.updateSocketIds = function () {
|
||||
for (var nsp in this.nsps) {
|
||||
if (has.call(this.nsps, nsp)) {
|
||||
this.nsps[nsp].id = this.engine.id;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Mix in `Emitter`.
|
||||
*/
|
||||
|
||||
Emitter(Manager.prototype);
|
||||
|
||||
/**
|
||||
* Sets the `reconnection` config.
|
||||
*
|
||||
* @param {Boolean} true/false if it should automatically reconnect
|
||||
* @return {Manager} self or value
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Manager.prototype.reconnection = function (v) {
|
||||
if (!arguments.length) return this._reconnection;
|
||||
this._reconnection = !!v;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the reconnection attempts config.
|
||||
*
|
||||
* @param {Number} max reconnection attempts before giving up
|
||||
* @return {Manager} self or value
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Manager.prototype.reconnectionAttempts = function (v) {
|
||||
if (!arguments.length) return this._reconnectionAttempts;
|
||||
this._reconnectionAttempts = v;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the delay between reconnections.
|
||||
*
|
||||
* @param {Number} delay
|
||||
* @return {Manager} self or value
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Manager.prototype.reconnectionDelay = function (v) {
|
||||
if (!arguments.length) return this._reconnectionDelay;
|
||||
this._reconnectionDelay = v;
|
||||
this.backoff && this.backoff.setMin(v);
|
||||
return this;
|
||||
};
|
||||
|
||||
Manager.prototype.randomizationFactor = function (v) {
|
||||
if (!arguments.length) return this._randomizationFactor;
|
||||
this._randomizationFactor = v;
|
||||
this.backoff && this.backoff.setJitter(v);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the maximum delay between reconnections.
|
||||
*
|
||||
* @param {Number} delay
|
||||
* @return {Manager} self or value
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Manager.prototype.reconnectionDelayMax = function (v) {
|
||||
if (!arguments.length) return this._reconnectionDelayMax;
|
||||
this._reconnectionDelayMax = v;
|
||||
this.backoff && this.backoff.setMax(v);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the connection timeout. `false` to disable
|
||||
*
|
||||
* @return {Manager} self or value
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Manager.prototype.timeout = function (v) {
|
||||
if (!arguments.length) return this._timeout;
|
||||
this._timeout = v;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Starts trying to reconnect if reconnection is enabled and we have not
|
||||
* started reconnecting yet
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Manager.prototype.maybeReconnectOnOpen = function () {
|
||||
// Only try to reconnect if it's the first time we're connecting
|
||||
if (!this.reconnecting && this._reconnection && this.backoff.attempts === 0) {
|
||||
// keeps reconnection from firing twice for the same reconnection loop
|
||||
this.reconnect();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the current transport `socket`.
|
||||
*
|
||||
* @param {Function} optional, callback
|
||||
* @return {Manager} self
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Manager.prototype.open =
|
||||
Manager.prototype.connect = function (fn, opts) {
|
||||
debug('readyState %s', this.readyState);
|
||||
if (~this.readyState.indexOf('open')) return this;
|
||||
|
||||
debug('opening %s', this.uri);
|
||||
this.engine = eio(this.uri, this.opts);
|
||||
var socket = this.engine;
|
||||
var self = this;
|
||||
this.readyState = 'opening';
|
||||
this.skipReconnect = false;
|
||||
|
||||
// emit `open`
|
||||
var openSub = on(socket, 'open', function () {
|
||||
self.onopen();
|
||||
fn && fn();
|
||||
});
|
||||
|
||||
// emit `connect_error`
|
||||
var errorSub = on(socket, 'error', function (data) {
|
||||
debug('connect_error');
|
||||
self.cleanup();
|
||||
self.readyState = 'closed';
|
||||
self.emitAll('connect_error', data);
|
||||
if (fn) {
|
||||
var err = new Error('Connection error');
|
||||
err.data = data;
|
||||
fn(err);
|
||||
} else {
|
||||
// Only do this if there is no fn to handle the error
|
||||
self.maybeReconnectOnOpen();
|
||||
}
|
||||
});
|
||||
|
||||
// emit `connect_timeout`
|
||||
if (false !== this._timeout) {
|
||||
var timeout = this._timeout;
|
||||
debug('connect attempt will timeout after %d', timeout);
|
||||
|
||||
// set timer
|
||||
var timer = setTimeout(function () {
|
||||
debug('connect attempt timed out after %d', timeout);
|
||||
openSub.destroy();
|
||||
socket.close();
|
||||
socket.emit('error', 'timeout');
|
||||
self.emitAll('connect_timeout', timeout);
|
||||
}, timeout);
|
||||
|
||||
this.subs.push({
|
||||
destroy: function () {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.subs.push(openSub);
|
||||
this.subs.push(errorSub);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon transport open.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Manager.prototype.onopen = function () {
|
||||
debug('open');
|
||||
|
||||
// clear old subs
|
||||
this.cleanup();
|
||||
|
||||
// mark as open
|
||||
this.readyState = 'open';
|
||||
this.emit('open');
|
||||
|
||||
// add new subs
|
||||
var socket = this.engine;
|
||||
this.subs.push(on(socket, 'data', bind(this, 'ondata')));
|
||||
this.subs.push(on(socket, 'ping', bind(this, 'onping')));
|
||||
this.subs.push(on(socket, 'pong', bind(this, 'onpong')));
|
||||
this.subs.push(on(socket, 'error', bind(this, 'onerror')));
|
||||
this.subs.push(on(socket, 'close', bind(this, 'onclose')));
|
||||
this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded')));
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon a ping.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Manager.prototype.onping = function () {
|
||||
this.lastPing = new Date();
|
||||
this.emitAll('ping');
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon a packet.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Manager.prototype.onpong = function () {
|
||||
this.emitAll('pong', new Date() - this.lastPing);
|
||||
};
|
||||
|
||||
/**
|
||||
* Called with data.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Manager.prototype.ondata = function (data) {
|
||||
this.decoder.add(data);
|
||||
};
|
||||
|
||||
/**
|
||||
* Called when parser fully decodes a packet.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Manager.prototype.ondecoded = function (packet) {
|
||||
this.emit('packet', packet);
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon socket error.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Manager.prototype.onerror = function (err) {
|
||||
debug('error', err);
|
||||
this.emitAll('error', err);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new socket for the given `nsp`.
|
||||
*
|
||||
* @return {Socket}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Manager.prototype.socket = function (nsp, opts) {
|
||||
var socket = this.nsps[nsp];
|
||||
if (!socket) {
|
||||
socket = new Socket(this, nsp, opts);
|
||||
this.nsps[nsp] = socket;
|
||||
var self = this;
|
||||
socket.on('connecting', onConnecting);
|
||||
socket.on('connect', function () {
|
||||
socket.id = self.engine.id;
|
||||
});
|
||||
|
||||
if (this.autoConnect) {
|
||||
// manually call here since connecting evnet is fired before listening
|
||||
onConnecting();
|
||||
}
|
||||
}
|
||||
|
||||
function onConnecting () {
|
||||
if (!~indexOf(self.connecting, socket)) {
|
||||
self.connecting.push(socket);
|
||||
}
|
||||
}
|
||||
|
||||
return socket;
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon a socket close.
|
||||
*
|
||||
* @param {Socket} socket
|
||||
*/
|
||||
|
||||
Manager.prototype.destroy = function (socket) {
|
||||
var index = indexOf(this.connecting, socket);
|
||||
if (~index) this.connecting.splice(index, 1);
|
||||
if (this.connecting.length) return;
|
||||
|
||||
this.close();
|
||||
};
|
||||
|
||||
/**
|
||||
* Writes a packet.
|
||||
*
|
||||
* @param {Object} packet
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Manager.prototype.packet = function (packet) {
|
||||
debug('writing packet %j', packet);
|
||||
var self = this;
|
||||
if (packet.query && packet.type === 0) packet.nsp += '?' + packet.query;
|
||||
|
||||
if (!self.encoding) {
|
||||
// encode, then write to engine with result
|
||||
self.encoding = true;
|
||||
this.encoder.encode(packet, function (encodedPackets) {
|
||||
for (var i = 0; i < encodedPackets.length; i++) {
|
||||
self.engine.write(encodedPackets[i], packet.options);
|
||||
}
|
||||
self.encoding = false;
|
||||
self.processPacketQueue();
|
||||
});
|
||||
} else { // add packet to the queue
|
||||
self.packetBuffer.push(packet);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* If packet buffer is non-empty, begins encoding the
|
||||
* next packet in line.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Manager.prototype.processPacketQueue = function () {
|
||||
if (this.packetBuffer.length > 0 && !this.encoding) {
|
||||
var pack = this.packetBuffer.shift();
|
||||
this.packet(pack);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Clean up transport subscriptions and packet buffer.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Manager.prototype.cleanup = function () {
|
||||
debug('cleanup');
|
||||
|
||||
var subsLength = this.subs.length;
|
||||
for (var i = 0; i < subsLength; i++) {
|
||||
var sub = this.subs.shift();
|
||||
sub.destroy();
|
||||
}
|
||||
|
||||
this.packetBuffer = [];
|
||||
this.encoding = false;
|
||||
this.lastPing = null;
|
||||
|
||||
this.decoder.destroy();
|
||||
};
|
||||
|
||||
/**
|
||||
* Close the current socket.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Manager.prototype.close =
|
||||
Manager.prototype.disconnect = function () {
|
||||
debug('disconnect');
|
||||
this.skipReconnect = true;
|
||||
this.reconnecting = false;
|
||||
if ('opening' === this.readyState) {
|
||||
// `onclose` will not fire because
|
||||
// an open event never happened
|
||||
this.cleanup();
|
||||
}
|
||||
this.backoff.reset();
|
||||
this.readyState = 'closed';
|
||||
if (this.engine) this.engine.close();
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon engine close.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Manager.prototype.onclose = function (reason) {
|
||||
debug('onclose');
|
||||
|
||||
this.cleanup();
|
||||
this.backoff.reset();
|
||||
this.readyState = 'closed';
|
||||
this.emit('close', reason);
|
||||
|
||||
if (this._reconnection && !this.skipReconnect) {
|
||||
this.reconnect();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Attempt a reconnection.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Manager.prototype.reconnect = function () {
|
||||
if (this.reconnecting || this.skipReconnect) return this;
|
||||
|
||||
var self = this;
|
||||
|
||||
if (this.backoff.attempts >= this._reconnectionAttempts) {
|
||||
debug('reconnect failed');
|
||||
this.backoff.reset();
|
||||
this.emitAll('reconnect_failed');
|
||||
this.reconnecting = false;
|
||||
} else {
|
||||
var delay = this.backoff.duration();
|
||||
debug('will wait %dms before reconnect attempt', delay);
|
||||
|
||||
this.reconnecting = true;
|
||||
var timer = setTimeout(function () {
|
||||
if (self.skipReconnect) return;
|
||||
|
||||
debug('attempting reconnect');
|
||||
self.emitAll('reconnect_attempt', self.backoff.attempts);
|
||||
self.emitAll('reconnecting', self.backoff.attempts);
|
||||
|
||||
// check again for the case socket closed in above events
|
||||
if (self.skipReconnect) return;
|
||||
|
||||
self.open(function (err) {
|
||||
if (err) {
|
||||
debug('reconnect attempt error');
|
||||
self.reconnecting = false;
|
||||
self.reconnect();
|
||||
self.emitAll('reconnect_error', err.data);
|
||||
} else {
|
||||
debug('reconnect success');
|
||||
self.onreconnect();
|
||||
}
|
||||
});
|
||||
}, delay);
|
||||
|
||||
this.subs.push({
|
||||
destroy: function () {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon successful reconnect.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Manager.prototype.onreconnect = function () {
|
||||
var attempt = this.backoff.attempts;
|
||||
this.reconnecting = false;
|
||||
this.backoff.reset();
|
||||
this.updateSocketIds();
|
||||
this.emitAll('reconnect', attempt);
|
||||
};
|
24
node_modules/socket.io-client/lib/on.js
generated
vendored
Normal file
24
node_modules/socket.io-client/lib/on.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = on;
|
||||
|
||||
/**
|
||||
* Helper for subscriptions.
|
||||
*
|
||||
* @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter`
|
||||
* @param {String} event name
|
||||
* @param {Function} callback
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function on (obj, ev, fn) {
|
||||
obj.on(ev, fn);
|
||||
return {
|
||||
destroy: function () {
|
||||
obj.removeListener(ev, fn);
|
||||
}
|
||||
};
|
||||
}
|
419
node_modules/socket.io-client/lib/socket.js
generated
vendored
Normal file
419
node_modules/socket.io-client/lib/socket.js
generated
vendored
Normal file
@ -0,0 +1,419 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var parser = require('socket.io-parser');
|
||||
var Emitter = require('component-emitter');
|
||||
var toArray = require('to-array');
|
||||
var on = require('./on');
|
||||
var bind = require('component-bind');
|
||||
var debug = require('debug')('socket.io-client:socket');
|
||||
var hasBin = require('has-binary');
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = exports = Socket;
|
||||
|
||||
/**
|
||||
* Internal events (blacklisted).
|
||||
* These events can't be emitted by the user.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
var events = {
|
||||
connect: 1,
|
||||
connect_error: 1,
|
||||
connect_timeout: 1,
|
||||
connecting: 1,
|
||||
disconnect: 1,
|
||||
error: 1,
|
||||
reconnect: 1,
|
||||
reconnect_attempt: 1,
|
||||
reconnect_failed: 1,
|
||||
reconnect_error: 1,
|
||||
reconnecting: 1,
|
||||
ping: 1,
|
||||
pong: 1
|
||||
};
|
||||
|
||||
/**
|
||||
* Shortcut to `Emitter#emit`.
|
||||
*/
|
||||
|
||||
var emit = Emitter.prototype.emit;
|
||||
|
||||
/**
|
||||
* `Socket` constructor.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Socket (io, nsp, opts) {
|
||||
this.io = io;
|
||||
this.nsp = nsp;
|
||||
this.json = this; // compat
|
||||
this.ids = 0;
|
||||
this.acks = {};
|
||||
this.receiveBuffer = [];
|
||||
this.sendBuffer = [];
|
||||
this.connected = false;
|
||||
this.disconnected = true;
|
||||
if (opts && opts.query) {
|
||||
this.query = opts.query;
|
||||
}
|
||||
if (this.io.autoConnect) this.open();
|
||||
}
|
||||
|
||||
/**
|
||||
* Mix in `Emitter`.
|
||||
*/
|
||||
|
||||
Emitter(Socket.prototype);
|
||||
|
||||
/**
|
||||
* Subscribe to open, close and packet events
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.subEvents = function () {
|
||||
if (this.subs) return;
|
||||
|
||||
var io = this.io;
|
||||
this.subs = [
|
||||
on(io, 'open', bind(this, 'onopen')),
|
||||
on(io, 'packet', bind(this, 'onpacket')),
|
||||
on(io, 'close', bind(this, 'onclose'))
|
||||
];
|
||||
};
|
||||
|
||||
/**
|
||||
* "Opens" the socket.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Socket.prototype.open =
|
||||
Socket.prototype.connect = function () {
|
||||
if (this.connected) return this;
|
||||
|
||||
this.subEvents();
|
||||
this.io.open(); // ensure open
|
||||
if ('open' === this.io.readyState) this.onopen();
|
||||
this.emit('connecting');
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sends a `message` event.
|
||||
*
|
||||
* @return {Socket} self
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Socket.prototype.send = function () {
|
||||
var args = toArray(arguments);
|
||||
args.unshift('message');
|
||||
this.emit.apply(this, args);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Override `emit`.
|
||||
* If the event is in `events`, it's emitted normally.
|
||||
*
|
||||
* @param {String} event name
|
||||
* @return {Socket} self
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Socket.prototype.emit = function (ev) {
|
||||
if (events.hasOwnProperty(ev)) {
|
||||
emit.apply(this, arguments);
|
||||
return this;
|
||||
}
|
||||
|
||||
var args = toArray(arguments);
|
||||
var parserType = parser.EVENT; // default
|
||||
if (hasBin(args)) { parserType = parser.BINARY_EVENT; } // binary
|
||||
var packet = { type: parserType, data: args };
|
||||
|
||||
packet.options = {};
|
||||
packet.options.compress = !this.flags || false !== this.flags.compress;
|
||||
|
||||
// event ack callback
|
||||
if ('function' === typeof args[args.length - 1]) {
|
||||
debug('emitting packet with ack id %d', this.ids);
|
||||
this.acks[this.ids] = args.pop();
|
||||
packet.id = this.ids++;
|
||||
}
|
||||
|
||||
if (this.connected) {
|
||||
this.packet(packet);
|
||||
} else {
|
||||
this.sendBuffer.push(packet);
|
||||
}
|
||||
|
||||
delete this.flags;
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sends a packet.
|
||||
*
|
||||
* @param {Object} packet
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.packet = function (packet) {
|
||||
packet.nsp = this.nsp;
|
||||
this.io.packet(packet);
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon engine `open`.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.onopen = function () {
|
||||
debug('transport is open - connecting');
|
||||
|
||||
// write connect packet if necessary
|
||||
if ('/' !== this.nsp) {
|
||||
if (this.query) {
|
||||
this.packet({type: parser.CONNECT, query: this.query});
|
||||
} else {
|
||||
this.packet({type: parser.CONNECT});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon engine `close`.
|
||||
*
|
||||
* @param {String} reason
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.onclose = function (reason) {
|
||||
debug('close (%s)', reason);
|
||||
this.connected = false;
|
||||
this.disconnected = true;
|
||||
delete this.id;
|
||||
this.emit('disconnect', reason);
|
||||
};
|
||||
|
||||
/**
|
||||
* Called with socket packet.
|
||||
*
|
||||
* @param {Object} packet
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.onpacket = function (packet) {
|
||||
if (packet.nsp !== this.nsp) return;
|
||||
|
||||
switch (packet.type) {
|
||||
case parser.CONNECT:
|
||||
this.onconnect();
|
||||
break;
|
||||
|
||||
case parser.EVENT:
|
||||
this.onevent(packet);
|
||||
break;
|
||||
|
||||
case parser.BINARY_EVENT:
|
||||
this.onevent(packet);
|
||||
break;
|
||||
|
||||
case parser.ACK:
|
||||
this.onack(packet);
|
||||
break;
|
||||
|
||||
case parser.BINARY_ACK:
|
||||
this.onack(packet);
|
||||
break;
|
||||
|
||||
case parser.DISCONNECT:
|
||||
this.ondisconnect();
|
||||
break;
|
||||
|
||||
case parser.ERROR:
|
||||
this.emit('error', packet.data);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon a server event.
|
||||
*
|
||||
* @param {Object} packet
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.onevent = function (packet) {
|
||||
var args = packet.data || [];
|
||||
debug('emitting event %j', args);
|
||||
|
||||
if (null != packet.id) {
|
||||
debug('attaching ack callback to event');
|
||||
args.push(this.ack(packet.id));
|
||||
}
|
||||
|
||||
if (this.connected) {
|
||||
emit.apply(this, args);
|
||||
} else {
|
||||
this.receiveBuffer.push(args);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Produces an ack callback to emit with an event.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.ack = function (id) {
|
||||
var self = this;
|
||||
var sent = false;
|
||||
return function () {
|
||||
// prevent double callbacks
|
||||
if (sent) return;
|
||||
sent = true;
|
||||
var args = toArray(arguments);
|
||||
debug('sending ack %j', args);
|
||||
|
||||
var type = hasBin(args) ? parser.BINARY_ACK : parser.ACK;
|
||||
self.packet({
|
||||
type: type,
|
||||
id: id,
|
||||
data: args
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon a server acknowlegement.
|
||||
*
|
||||
* @param {Object} packet
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.onack = function (packet) {
|
||||
var ack = this.acks[packet.id];
|
||||
if ('function' === typeof ack) {
|
||||
debug('calling ack %s with %j', packet.id, packet.data);
|
||||
ack.apply(this, packet.data);
|
||||
delete this.acks[packet.id];
|
||||
} else {
|
||||
debug('bad ack %s', packet.id);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon server connect.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.onconnect = function () {
|
||||
this.connected = true;
|
||||
this.disconnected = false;
|
||||
this.emit('connect');
|
||||
this.emitBuffered();
|
||||
};
|
||||
|
||||
/**
|
||||
* Emit buffered events (received and emitted).
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.emitBuffered = function () {
|
||||
var i;
|
||||
for (i = 0; i < this.receiveBuffer.length; i++) {
|
||||
emit.apply(this, this.receiveBuffer[i]);
|
||||
}
|
||||
this.receiveBuffer = [];
|
||||
|
||||
for (i = 0; i < this.sendBuffer.length; i++) {
|
||||
this.packet(this.sendBuffer[i]);
|
||||
}
|
||||
this.sendBuffer = [];
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon server disconnect.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.ondisconnect = function () {
|
||||
debug('server disconnect (%s)', this.nsp);
|
||||
this.destroy();
|
||||
this.onclose('io server disconnect');
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon forced client/server side disconnections,
|
||||
* this method ensures the manager stops tracking us and
|
||||
* that reconnections don't get triggered for this.
|
||||
*
|
||||
* @api private.
|
||||
*/
|
||||
|
||||
Socket.prototype.destroy = function () {
|
||||
if (this.subs) {
|
||||
// clean subscriptions to avoid reconnections
|
||||
for (var i = 0; i < this.subs.length; i++) {
|
||||
this.subs[i].destroy();
|
||||
}
|
||||
this.subs = null;
|
||||
}
|
||||
|
||||
this.io.destroy(this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Disconnects the socket manually.
|
||||
*
|
||||
* @return {Socket} self
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Socket.prototype.close =
|
||||
Socket.prototype.disconnect = function () {
|
||||
if (this.connected) {
|
||||
debug('performing disconnect (%s)', this.nsp);
|
||||
this.packet({ type: parser.DISCONNECT });
|
||||
}
|
||||
|
||||
// remove socket from pool
|
||||
this.destroy();
|
||||
|
||||
if (this.connected) {
|
||||
// fire events
|
||||
this.onclose('io client disconnect');
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the compress flag.
|
||||
*
|
||||
* @param {Boolean} if `true`, compresses the sending data
|
||||
* @return {Socket} self
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Socket.prototype.compress = function (compress) {
|
||||
this.flags = this.flags || {};
|
||||
this.flags.compress = compress;
|
||||
return this;
|
||||
};
|
75
node_modules/socket.io-client/lib/url.js
generated
vendored
Normal file
75
node_modules/socket.io-client/lib/url.js
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var parseuri = require('parseuri');
|
||||
var debug = require('debug')('socket.io-client:url');
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = url;
|
||||
|
||||
/**
|
||||
* URL parser.
|
||||
*
|
||||
* @param {String} url
|
||||
* @param {Object} An object meant to mimic window.location.
|
||||
* Defaults to window.location.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function url (uri, loc) {
|
||||
var obj = uri;
|
||||
|
||||
// default to window.location
|
||||
loc = loc || global.location;
|
||||
if (null == uri) uri = loc.protocol + '//' + loc.host;
|
||||
|
||||
// relative path support
|
||||
if ('string' === typeof uri) {
|
||||
if ('/' === uri.charAt(0)) {
|
||||
if ('/' === uri.charAt(1)) {
|
||||
uri = loc.protocol + uri;
|
||||
} else {
|
||||
uri = loc.host + uri;
|
||||
}
|
||||
}
|
||||
|
||||
if (!/^(https?|wss?):\/\//.test(uri)) {
|
||||
debug('protocol-less url %s', uri);
|
||||
if ('undefined' !== typeof loc) {
|
||||
uri = loc.protocol + '//' + uri;
|
||||
} else {
|
||||
uri = 'https://' + uri;
|
||||
}
|
||||
}
|
||||
|
||||
// parse
|
||||
debug('parse %s', uri);
|
||||
obj = parseuri(uri);
|
||||
}
|
||||
|
||||
// make sure we treat `localhost:80` and `localhost` equally
|
||||
if (!obj.port) {
|
||||
if (/^(http|ws)$/.test(obj.protocol)) {
|
||||
obj.port = '80';
|
||||
} else if (/^(http|ws)s$/.test(obj.protocol)) {
|
||||
obj.port = '443';
|
||||
}
|
||||
}
|
||||
|
||||
obj.path = obj.path || '/';
|
||||
|
||||
var ipv6 = obj.host.indexOf(':') !== -1;
|
||||
var host = ipv6 ? '[' + obj.host + ']' : obj.host;
|
||||
|
||||
// define unique id
|
||||
obj.id = obj.protocol + '://' + host + ':' + obj.port;
|
||||
// define href
|
||||
obj.href = obj.protocol + '://' + host + (loc && loc.port === obj.port ? '' : (':' + obj.port));
|
||||
|
||||
return obj;
|
||||
}
|
68
node_modules/socket.io-client/node_modules/component-emitter/History.md
generated
vendored
Normal file
68
node_modules/socket.io-client/node_modules/component-emitter/History.md
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
|
||||
1.2.1 / 2016-04-18
|
||||
==================
|
||||
|
||||
* enable client side use
|
||||
|
||||
1.2.0 / 2014-02-12
|
||||
==================
|
||||
|
||||
* prefix events with `$` to support object prototype method names
|
||||
|
||||
1.1.3 / 2014-06-20
|
||||
==================
|
||||
|
||||
* republish for npm
|
||||
* add LICENSE file
|
||||
|
||||
1.1.2 / 2014-02-10
|
||||
==================
|
||||
|
||||
* package: rename to "component-emitter"
|
||||
* package: update "main" and "component" fields
|
||||
* Add license to Readme (same format as the other components)
|
||||
* created .npmignore
|
||||
* travis stuff
|
||||
|
||||
1.1.1 / 2013-12-01
|
||||
==================
|
||||
|
||||
* fix .once adding .on to the listener
|
||||
* docs: Emitter#off()
|
||||
* component: add `.repo` prop
|
||||
|
||||
1.1.0 / 2013-10-20
|
||||
==================
|
||||
|
||||
* add `.addEventListener()` and `.removeEventListener()` aliases
|
||||
|
||||
1.0.1 / 2013-06-27
|
||||
==================
|
||||
|
||||
* add support for legacy ie
|
||||
|
||||
1.0.0 / 2013-02-26
|
||||
==================
|
||||
|
||||
* add `.off()` support for removing all listeners
|
||||
|
||||
0.0.6 / 2012-10-08
|
||||
==================
|
||||
|
||||
* add `this._callbacks` initialization to prevent funky gotcha
|
||||
|
||||
0.0.5 / 2012-09-07
|
||||
==================
|
||||
|
||||
* fix `Emitter.call(this)` usage
|
||||
|
||||
0.0.3 / 2012-07-11
|
||||
==================
|
||||
|
||||
* add `.listeners()`
|
||||
* rename `.has()` to `.hasListeners()`
|
||||
|
||||
0.0.2 / 2012-06-28
|
||||
==================
|
||||
|
||||
* fix `.off()` with `.once()`-registered callbacks
|
24
node_modules/socket.io-client/node_modules/component-emitter/LICENSE
generated
vendored
Normal file
24
node_modules/socket.io-client/node_modules/component-emitter/LICENSE
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Component contributors <dev@component.io>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
74
node_modules/socket.io-client/node_modules/component-emitter/Readme.md
generated
vendored
Normal file
74
node_modules/socket.io-client/node_modules/component-emitter/Readme.md
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
# Emitter [](https://travis-ci.org/component/emitter)
|
||||
|
||||
Event emitter component.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
$ component install component/emitter
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### Emitter(obj)
|
||||
|
||||
The `Emitter` may also be used as a mixin. For example
|
||||
a "plain" object may become an emitter, or you may
|
||||
extend an existing prototype.
|
||||
|
||||
As an `Emitter` instance:
|
||||
|
||||
```js
|
||||
var Emitter = require('emitter');
|
||||
var emitter = new Emitter;
|
||||
emitter.emit('something');
|
||||
```
|
||||
|
||||
As a mixin:
|
||||
|
||||
```js
|
||||
var Emitter = require('emitter');
|
||||
var user = { name: 'tobi' };
|
||||
Emitter(user);
|
||||
|
||||
user.emit('im a user');
|
||||
```
|
||||
|
||||
As a prototype mixin:
|
||||
|
||||
```js
|
||||
var Emitter = require('emitter');
|
||||
Emitter(User.prototype);
|
||||
```
|
||||
|
||||
### Emitter#on(event, fn)
|
||||
|
||||
Register an `event` handler `fn`.
|
||||
|
||||
### Emitter#once(event, fn)
|
||||
|
||||
Register a single-shot `event` handler `fn`,
|
||||
removed immediately after it is invoked the
|
||||
first time.
|
||||
|
||||
### Emitter#off(event, fn)
|
||||
|
||||
* Pass `event` and `fn` to remove a listener.
|
||||
* Pass `event` to remove all listeners on that event.
|
||||
* Pass nothing to remove all listeners on all events.
|
||||
|
||||
### Emitter#emit(event, ...)
|
||||
|
||||
Emit an `event` with variable option args.
|
||||
|
||||
### Emitter#listeners(event)
|
||||
|
||||
Return an array of callbacks, or an empty array.
|
||||
|
||||
### Emitter#hasListeners(event)
|
||||
|
||||
Check if this emitter has `event` handlers.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
163
node_modules/socket.io-client/node_modules/component-emitter/index.js
generated
vendored
Normal file
163
node_modules/socket.io-client/node_modules/component-emitter/index.js
generated
vendored
Normal file
@ -0,0 +1,163 @@
|
||||
|
||||
/**
|
||||
* Expose `Emitter`.
|
||||
*/
|
||||
|
||||
if (typeof module !== 'undefined') {
|
||||
module.exports = Emitter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize a new `Emitter`.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Emitter(obj) {
|
||||
if (obj) return mixin(obj);
|
||||
};
|
||||
|
||||
/**
|
||||
* Mixin the emitter properties.
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @return {Object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function mixin(obj) {
|
||||
for (var key in Emitter.prototype) {
|
||||
obj[key] = Emitter.prototype[key];
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Listen on the given `event` with `fn`.
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {Function} fn
|
||||
* @return {Emitter}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Emitter.prototype.on =
|
||||
Emitter.prototype.addEventListener = function(event, fn){
|
||||
this._callbacks = this._callbacks || {};
|
||||
(this._callbacks['$' + event] = this._callbacks['$' + event] || [])
|
||||
.push(fn);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds an `event` listener that will be invoked a single
|
||||
* time then automatically removed.
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {Function} fn
|
||||
* @return {Emitter}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Emitter.prototype.once = function(event, fn){
|
||||
function on() {
|
||||
this.off(event, on);
|
||||
fn.apply(this, arguments);
|
||||
}
|
||||
|
||||
on.fn = fn;
|
||||
this.on(event, on);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove the given callback for `event` or all
|
||||
* registered callbacks.
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {Function} fn
|
||||
* @return {Emitter}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Emitter.prototype.off =
|
||||
Emitter.prototype.removeListener =
|
||||
Emitter.prototype.removeAllListeners =
|
||||
Emitter.prototype.removeEventListener = function(event, fn){
|
||||
this._callbacks = this._callbacks || {};
|
||||
|
||||
// all
|
||||
if (0 == arguments.length) {
|
||||
this._callbacks = {};
|
||||
return this;
|
||||
}
|
||||
|
||||
// specific event
|
||||
var callbacks = this._callbacks['$' + event];
|
||||
if (!callbacks) return this;
|
||||
|
||||
// remove all handlers
|
||||
if (1 == arguments.length) {
|
||||
delete this._callbacks['$' + event];
|
||||
return this;
|
||||
}
|
||||
|
||||
// remove specific handler
|
||||
var cb;
|
||||
for (var i = 0; i < callbacks.length; i++) {
|
||||
cb = callbacks[i];
|
||||
if (cb === fn || cb.fn === fn) {
|
||||
callbacks.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Emit `event` with the given args.
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {Mixed} ...
|
||||
* @return {Emitter}
|
||||
*/
|
||||
|
||||
Emitter.prototype.emit = function(event){
|
||||
this._callbacks = this._callbacks || {};
|
||||
var args = [].slice.call(arguments, 1)
|
||||
, callbacks = this._callbacks['$' + event];
|
||||
|
||||
if (callbacks) {
|
||||
callbacks = callbacks.slice(0);
|
||||
for (var i = 0, len = callbacks.length; i < len; ++i) {
|
||||
callbacks[i].apply(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return array of callbacks for `event`.
|
||||
*
|
||||
* @param {String} event
|
||||
* @return {Array}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Emitter.prototype.listeners = function(event){
|
||||
this._callbacks = this._callbacks || {};
|
||||
return this._callbacks['$' + event] || [];
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if this emitter has `event` handlers.
|
||||
*
|
||||
* @param {String} event
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Emitter.prototype.hasListeners = function(event){
|
||||
return !! this.listeners(event).length;
|
||||
};
|
207
node_modules/socket.io-client/node_modules/component-emitter/package.json
generated
vendored
Normal file
207
node_modules/socket.io-client/node_modules/component-emitter/package.json
generated
vendored
Normal file
@ -0,0 +1,207 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"component-emitter@1.2.1",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\socket.io-client"
|
||||
]
|
||||
],
|
||||
"_from": "component-emitter@1.2.1",
|
||||
"_id": "component-emitter@1.2.1",
|
||||
"_inCache": true,
|
||||
"_location": "/socket.io-client/component-emitter",
|
||||
"_nodeVersion": "0.12.4",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/component-emitter-1.2.1.tgz_1461005707641_0.14232611074112356"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "karp@hotmail.fr",
|
||||
"name": "nami-doc"
|
||||
},
|
||||
"_npmVersion": "2.10.1",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "component-emitter",
|
||||
"raw": "component-emitter@1.2.1",
|
||||
"rawSpec": "1.2.1",
|
||||
"scope": null,
|
||||
"spec": "1.2.1",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/socket.io-client"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz",
|
||||
"_shasum": "137918d6d78283f7df7a6b7c5a63e140e69425e6",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "component-emitter@1.2.1",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\socket.io-client",
|
||||
"bugs": {
|
||||
"url": "https://github.com/component/emitter/issues"
|
||||
},
|
||||
"component": {
|
||||
"scripts": {
|
||||
"emitter/index.js": "index.js"
|
||||
}
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Event emitter",
|
||||
"devDependencies": {
|
||||
"mocha": "*",
|
||||
"should": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "137918d6d78283f7df7a6b7c5a63e140e69425e6",
|
||||
"tarball": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "187492ab8028c7221b589bdfd482b715149cd868",
|
||||
"homepage": "https://github.com/component/emitter#readme",
|
||||
"installable": true,
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "swatinem",
|
||||
"email": "arpad.borsos@googlemail.com"
|
||||
},
|
||||
{
|
||||
"name": "tootallnate",
|
||||
"email": "nathan@tootallnate.net"
|
||||
},
|
||||
{
|
||||
"name": "trevorgerhardt",
|
||||
"email": "trevorgerhardt@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "timaschew",
|
||||
"email": "timaschew@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "tjholowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
{
|
||||
"name": "rauchg",
|
||||
"email": "rauchg@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "retrofox",
|
||||
"email": "rdsuarez@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "coreh",
|
||||
"email": "thecoreh@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "forbeslindesay",
|
||||
"email": "forbes@lindesay.co.uk"
|
||||
},
|
||||
{
|
||||
"name": "kelonye",
|
||||
"email": "kelonyemitchel@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "mattmueller",
|
||||
"email": "mattmuelle@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "yields",
|
||||
"email": "yields@icloud.com"
|
||||
},
|
||||
{
|
||||
"name": "anthonyshort",
|
||||
"email": "antshort@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "jongleberry",
|
||||
"email": "jonathanrichardong@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "ianstormtaylor",
|
||||
"email": "ian@ianstormtaylor.com"
|
||||
},
|
||||
{
|
||||
"name": "cristiandouce",
|
||||
"email": "cristian@gravityonmars.com"
|
||||
},
|
||||
{
|
||||
"name": "hughsk",
|
||||
"email": "hughskennedy@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "stagas",
|
||||
"email": "gstagas@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "amasad",
|
||||
"email": "amjad.masad@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "juliangruber",
|
||||
"email": "julian@juliangruber.com"
|
||||
},
|
||||
{
|
||||
"name": "calvinfo",
|
||||
"email": "calvin@calv.info"
|
||||
},
|
||||
{
|
||||
"name": "dominicbarnes",
|
||||
"email": "dominic@dbarnes.info"
|
||||
},
|
||||
{
|
||||
"name": "blakeembrey",
|
||||
"email": "hello@blakeembrey.com"
|
||||
},
|
||||
{
|
||||
"name": "timoxley",
|
||||
"email": "secoif@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "jonathanong",
|
||||
"email": "jonathanrichardong@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "queckezz",
|
||||
"email": "fabian.eichenberger@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "nami-doc",
|
||||
"email": "vendethiel@hotmail.fr"
|
||||
},
|
||||
{
|
||||
"name": "clintwood",
|
||||
"email": "clint@anotherway.co.za"
|
||||
},
|
||||
{
|
||||
"name": "thehydroimpulse",
|
||||
"email": "dnfagnan@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "stephenmathieson",
|
||||
"email": "me@stephenmathieson.com"
|
||||
},
|
||||
{
|
||||
"name": "dfcreative",
|
||||
"email": "df.creative@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "defunctzombie",
|
||||
"email": "shtylman@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "component-emitter",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/component/emitter.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"version": "1.2.1"
|
||||
}
|
3
node_modules/socket.io-client/node_modules/debug/.jshintrc
generated
vendored
Normal file
3
node_modules/socket.io-client/node_modules/debug/.jshintrc
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"laxbreak": true
|
||||
}
|
7
node_modules/socket.io-client/node_modules/debug/.npmignore
generated
vendored
Normal file
7
node_modules/socket.io-client/node_modules/debug/.npmignore
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
support
|
||||
test
|
||||
examples
|
||||
example
|
||||
*.sock
|
||||
dist
|
||||
yarn.lock
|
235
node_modules/socket.io-client/node_modules/debug/CHANGELOG.md
generated
vendored
Normal file
235
node_modules/socket.io-client/node_modules/debug/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,235 @@
|
||||
2.3.3 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne)
|
||||
* Fix: Returning `localStorage` saved values (#331, Levi Thomason)
|
||||
* Improvement: Don't create an empty object when no `process` (Nathan Rajlich)
|
||||
|
||||
2.3.2 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: be super-safe in index.js as well (@TooTallNate)
|
||||
* Fix: should check whether process exists (Tom Newby)
|
||||
|
||||
2.3.1 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: Added electron compatibility (#324, @paulcbetts)
|
||||
* Improvement: Added performance optimizations (@tootallnate)
|
||||
* Readme: Corrected PowerShell environment variable example (#252, @gimre)
|
||||
* Misc: Removed yarn lock file from source control (#321, @fengmk2)
|
||||
|
||||
2.3.0 / 2016-11-07
|
||||
==================
|
||||
|
||||
* Fix: Consistent placement of ms diff at end of output (#215, @gorangajic)
|
||||
* Fix: Escaping of regex special characters in namespace strings (#250, @zacronos)
|
||||
* Fix: Fixed bug causing crash on react-native (#282, @vkarpov15)
|
||||
* Feature: Enabled ES6+ compatible import via default export (#212 @bucaran)
|
||||
* Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom)
|
||||
* Package: Update "ms" to 0.7.2 (#315, @DevSide)
|
||||
* Package: removed superfluous version property from bower.json (#207 @kkirsche)
|
||||
* Readme: fix USE_COLORS to DEBUG_COLORS
|
||||
* Readme: Doc fixes for format string sugar (#269, @mlucool)
|
||||
* Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0)
|
||||
* Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable)
|
||||
* Readme: better docs for browser support (#224, @matthewmueller)
|
||||
* Tooling: Added yarn integration for development (#317, @thebigredgeek)
|
||||
* Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek)
|
||||
* Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman)
|
||||
* Misc: Updated contributors (@thebigredgeek)
|
||||
|
||||
2.2.0 / 2015-05-09
|
||||
==================
|
||||
|
||||
* package: update "ms" to v0.7.1 (#202, @dougwilson)
|
||||
* README: add logging to file example (#193, @DanielOchoa)
|
||||
* README: fixed a typo (#191, @amir-s)
|
||||
* browser: expose `storage` (#190, @stephenmathieson)
|
||||
* Makefile: add a `distclean` target (#189, @stephenmathieson)
|
||||
|
||||
2.1.3 / 2015-03-13
|
||||
==================
|
||||
|
||||
* Updated stdout/stderr example (#186)
|
||||
* Updated example/stdout.js to match debug current behaviour
|
||||
* Renamed example/stderr.js to stdout.js
|
||||
* Update Readme.md (#184)
|
||||
* replace high intensity foreground color for bold (#182, #183)
|
||||
|
||||
2.1.2 / 2015-03-01
|
||||
==================
|
||||
|
||||
* dist: recompile
|
||||
* update "ms" to v0.7.0
|
||||
* package: update "browserify" to v9.0.3
|
||||
* component: fix "ms.js" repo location
|
||||
* changed bower package name
|
||||
* updated documentation about using debug in a browser
|
||||
* fix: security error on safari (#167, #168, @yields)
|
||||
|
||||
2.1.1 / 2014-12-29
|
||||
==================
|
||||
|
||||
* browser: use `typeof` to check for `console` existence
|
||||
* browser: check for `console.log` truthiness (fix IE 8/9)
|
||||
* browser: add support for Chrome apps
|
||||
* Readme: added Windows usage remarks
|
||||
* Add `bower.json` to properly support bower install
|
||||
|
||||
2.1.0 / 2014-10-15
|
||||
==================
|
||||
|
||||
* node: implement `DEBUG_FD` env variable support
|
||||
* package: update "browserify" to v6.1.0
|
||||
* package: add "license" field to package.json (#135, @panuhorsmalahti)
|
||||
|
||||
2.0.0 / 2014-09-01
|
||||
==================
|
||||
|
||||
* package: update "browserify" to v5.11.0
|
||||
* node: use stderr rather than stdout for logging (#29, @stephenmathieson)
|
||||
|
||||
1.0.4 / 2014-07-15
|
||||
==================
|
||||
|
||||
* dist: recompile
|
||||
* example: remove `console.info()` log usage
|
||||
* example: add "Content-Type" UTF-8 header to browser example
|
||||
* browser: place %c marker after the space character
|
||||
* browser: reset the "content" color via `color: inherit`
|
||||
* browser: add colors support for Firefox >= v31
|
||||
* debug: prefer an instance `log()` function over the global one (#119)
|
||||
* Readme: update documentation about styled console logs for FF v31 (#116, @wryk)
|
||||
|
||||
1.0.3 / 2014-07-09
|
||||
==================
|
||||
|
||||
* Add support for multiple wildcards in namespaces (#122, @seegno)
|
||||
* browser: fix lint
|
||||
|
||||
1.0.2 / 2014-06-10
|
||||
==================
|
||||
|
||||
* browser: update color palette (#113, @gscottolson)
|
||||
* common: make console logging function configurable (#108, @timoxley)
|
||||
* node: fix %o colors on old node <= 0.8.x
|
||||
* Makefile: find node path using shell/which (#109, @timoxley)
|
||||
|
||||
1.0.1 / 2014-06-06
|
||||
==================
|
||||
|
||||
* browser: use `removeItem()` to clear localStorage
|
||||
* browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777)
|
||||
* package: add "contributors" section
|
||||
* node: fix comment typo
|
||||
* README: list authors
|
||||
|
||||
1.0.0 / 2014-06-04
|
||||
==================
|
||||
|
||||
* make ms diff be global, not be scope
|
||||
* debug: ignore empty strings in enable()
|
||||
* node: make DEBUG_COLORS able to disable coloring
|
||||
* *: export the `colors` array
|
||||
* npmignore: don't publish the `dist` dir
|
||||
* Makefile: refactor to use browserify
|
||||
* package: add "browserify" as a dev dependency
|
||||
* Readme: add Web Inspector Colors section
|
||||
* node: reset terminal color for the debug content
|
||||
* node: map "%o" to `util.inspect()`
|
||||
* browser: map "%j" to `JSON.stringify()`
|
||||
* debug: add custom "formatters"
|
||||
* debug: use "ms" module for humanizing the diff
|
||||
* Readme: add "bash" syntax highlighting
|
||||
* browser: add Firebug color support
|
||||
* browser: add colors for WebKit browsers
|
||||
* node: apply log to `console`
|
||||
* rewrite: abstract common logic for Node & browsers
|
||||
* add .jshintrc file
|
||||
|
||||
0.8.1 / 2014-04-14
|
||||
==================
|
||||
|
||||
* package: re-add the "component" section
|
||||
|
||||
0.8.0 / 2014-03-30
|
||||
==================
|
||||
|
||||
* add `enable()` method for nodejs. Closes #27
|
||||
* change from stderr to stdout
|
||||
* remove unnecessary index.js file
|
||||
|
||||
0.7.4 / 2013-11-13
|
||||
==================
|
||||
|
||||
* remove "browserify" key from package.json (fixes something in browserify)
|
||||
|
||||
0.7.3 / 2013-10-30
|
||||
==================
|
||||
|
||||
* fix: catch localStorage security error when cookies are blocked (Chrome)
|
||||
* add debug(err) support. Closes #46
|
||||
* add .browser prop to package.json. Closes #42
|
||||
|
||||
0.7.2 / 2013-02-06
|
||||
==================
|
||||
|
||||
* fix package.json
|
||||
* fix: Mobile Safari (private mode) is broken with debug
|
||||
* fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript
|
||||
|
||||
0.7.1 / 2013-02-05
|
||||
==================
|
||||
|
||||
* add repository URL to package.json
|
||||
* add DEBUG_COLORED to force colored output
|
||||
* add browserify support
|
||||
* fix component. Closes #24
|
||||
|
||||
0.7.0 / 2012-05-04
|
||||
==================
|
||||
|
||||
* Added .component to package.json
|
||||
* Added debug.component.js build
|
||||
|
||||
0.6.0 / 2012-03-16
|
||||
==================
|
||||
|
||||
* Added support for "-" prefix in DEBUG [Vinay Pulim]
|
||||
* Added `.enabled` flag to the node version [TooTallNate]
|
||||
|
||||
0.5.0 / 2012-02-02
|
||||
==================
|
||||
|
||||
* Added: humanize diffs. Closes #8
|
||||
* Added `debug.disable()` to the CS variant
|
||||
* Removed padding. Closes #10
|
||||
* Fixed: persist client-side variant again. Closes #9
|
||||
|
||||
0.4.0 / 2012-02-01
|
||||
==================
|
||||
|
||||
* Added browser variant support for older browsers [TooTallNate]
|
||||
* Added `debug.enable('project:*')` to browser variant [TooTallNate]
|
||||
* Added padding to diff (moved it to the right)
|
||||
|
||||
0.3.0 / 2012-01-26
|
||||
==================
|
||||
|
||||
* Added millisecond diff when isatty, otherwise UTC string
|
||||
|
||||
0.2.0 / 2012-01-22
|
||||
==================
|
||||
|
||||
* Added wildcard support
|
||||
|
||||
0.1.0 / 2011-12-02
|
||||
==================
|
||||
|
||||
* Added: remove colors unless stderr isatty [TooTallNate]
|
||||
|
||||
0.0.1 / 2010-01-03
|
||||
==================
|
||||
|
||||
* Initial release
|
19
node_modules/socket.io-client/node_modules/debug/LICENSE
generated
vendored
Normal file
19
node_modules/socket.io-client/node_modules/debug/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||
and associated documentation files (the 'Software'), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial
|
||||
portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
37
node_modules/socket.io-client/node_modules/debug/Makefile
generated
vendored
Normal file
37
node_modules/socket.io-client/node_modules/debug/Makefile
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
|
||||
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
|
||||
|
||||
# BIN directory
|
||||
BIN := $(THIS_DIR)/node_modules/.bin
|
||||
|
||||
# applications
|
||||
NODE ?= $(shell which node)
|
||||
YARN ?= $(shell which yarn)
|
||||
PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm))
|
||||
BROWSERIFY ?= $(NODE) $(BIN)/browserify
|
||||
|
||||
all: dist/debug.js
|
||||
|
||||
install: node_modules
|
||||
|
||||
clean:
|
||||
@rm -rf dist
|
||||
|
||||
dist:
|
||||
@mkdir -p $@
|
||||
|
||||
dist/debug.js: node_modules browser.js debug.js dist
|
||||
@$(BROWSERIFY) \
|
||||
--standalone debug \
|
||||
. > $@
|
||||
|
||||
distclean: clean
|
||||
@rm -rf node_modules
|
||||
|
||||
node_modules: package.json
|
||||
@NODE_ENV= $(PKG) install
|
||||
@touch node_modules
|
||||
|
||||
.PHONY: all install clean distclean
|
199
node_modules/socket.io-client/node_modules/debug/Readme.md
generated
vendored
Normal file
199
node_modules/socket.io-client/node_modules/debug/Readme.md
generated
vendored
Normal file
@ -0,0 +1,199 @@
|
||||
# debug
|
||||
|
||||
tiny node.js debugging utility modelled after node core's debugging technique.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install debug
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` [format string goodies](https://developer.chrome.com/devtools/docs/console-api#consolelogobject-object) you're used to work fine. A unique color is selected per-function for visibility.
|
||||
|
||||
Example _app.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug')('http')
|
||||
, http = require('http')
|
||||
, name = 'My App';
|
||||
|
||||
// fake app
|
||||
|
||||
debug('booting %s', name);
|
||||
|
||||
http.createServer(function(req, res){
|
||||
debug(req.method + ' ' + req.url);
|
||||
res.end('hello\n');
|
||||
}).listen(3000, function(){
|
||||
debug('listening');
|
||||
});
|
||||
|
||||
// fake worker of some kind
|
||||
|
||||
require('./worker');
|
||||
```
|
||||
|
||||
Example _worker.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug')('worker');
|
||||
|
||||
setInterval(function(){
|
||||
debug('doing some work');
|
||||
}, 1000);
|
||||
```
|
||||
|
||||
The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
#### Windows note
|
||||
|
||||
On Windows the environment variable is set using the `set` command.
|
||||
|
||||
```cmd
|
||||
set DEBUG=*,-not_this
|
||||
```
|
||||
|
||||
Note that PowerShell using different syntax to set environment variables.
|
||||
|
||||
```cmd
|
||||
$env:DEBUG = "*,-not_this"
|
||||
```
|
||||
|
||||
Then, run the program to be debugged as usual.
|
||||
|
||||
## Millisecond diff
|
||||
|
||||
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
|
||||
|
||||

|
||||
|
||||
When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:
|
||||
|
||||

|
||||
|
||||
## Conventions
|
||||
|
||||
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser".
|
||||
|
||||
## Wildcards
|
||||
|
||||
The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
|
||||
|
||||
You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:".
|
||||
|
||||
## Browser support
|
||||
|
||||
Debug works in the browser as well, currently persisted by `localStorage`. Consider the situation shown below where you have `worker:a` and `worker:b`, and wish to debug both. You can enable this using `localStorage.debug`:
|
||||
|
||||
```js
|
||||
localStorage.debug = 'worker:*'
|
||||
```
|
||||
|
||||
And then refresh the page.
|
||||
|
||||
```js
|
||||
a = debug('worker:a');
|
||||
b = debug('worker:b');
|
||||
|
||||
setInterval(function(){
|
||||
a('doing some work');
|
||||
}, 1000);
|
||||
|
||||
setInterval(function(){
|
||||
b('doing some work');
|
||||
}, 1200);
|
||||
```
|
||||
|
||||
#### Web Inspector Colors
|
||||
|
||||
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
|
||||
option. These are WebKit web inspectors, Firefox ([since version
|
||||
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
|
||||
and the Firebug plugin for Firefox (any version).
|
||||
|
||||
Colored output looks something like:
|
||||
|
||||

|
||||
|
||||
## Output streams
|
||||
|
||||
|
||||
### stderr vs stdout
|
||||
By default `debug` will log to stderr, however this can be changed by setting the environment variable `DEBUG_FD` to `1` for stdout and `2` for stderr (the default value).
|
||||
|
||||
You can also set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally:
|
||||
|
||||
Example _stdout.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug');
|
||||
var error = debug('app:error');
|
||||
|
||||
// by default stderr is used
|
||||
error('goes to stderr!');
|
||||
|
||||
var log = debug('app:log');
|
||||
// set this namespace to log via console.log
|
||||
log.log = console.log.bind(console); // don't forget to bind to console!
|
||||
log('goes to stdout');
|
||||
error('still goes to stderr!');
|
||||
|
||||
// set all output to go via console.info
|
||||
// overrides all per-namespace log settings
|
||||
debug.log = console.info.bind(console);
|
||||
error('now goes to stdout via console.info');
|
||||
log('still goes to stdout, but via console.info now');
|
||||
```
|
||||
|
||||
### Save debug output to a file
|
||||
|
||||
You can save all debug statements to a file by piping them.
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
$ DEBUG_FD=3 node your-app.js 3> whatever.log
|
||||
```
|
||||
|
||||
### Terminal colors
|
||||
|
||||
By default colors will only be used in a TTY. However this can be overridden by setting the environment variable `DEBUG_COLORS` to `1`.
|
||||
|
||||
Note: Certain IDEs (such as WebStorm) don't support colors on stderr. In these cases you must set `DEBUG_COLORS` to `1` and additionally change `DEBUG_FD` to `1`.
|
||||
|
||||
## Authors
|
||||
|
||||
- TJ Holowaychuk
|
||||
- Nathan Rajlich
|
||||
- Andrew Rhyne
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014-2016 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
29
node_modules/socket.io-client/node_modules/debug/bower.json
generated
vendored
Normal file
29
node_modules/socket.io-client/node_modules/debug/bower.json
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "visionmedia-debug",
|
||||
"main": "dist/debug.js",
|
||||
"homepage": "https://github.com/visionmedia/debug",
|
||||
"authors": [
|
||||
"TJ Holowaychuk <tj@vision-media.ca>",
|
||||
"Nathan Rajlich <nathan@tootallnate.net> (http://n8.io)",
|
||||
"Andrew Rhyne <rhyneandrew@gmail.com>"
|
||||
],
|
||||
"description": "visionmedia-debug",
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"es6",
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": [
|
||||
"visionmedia",
|
||||
"debug"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
]
|
||||
}
|
177
node_modules/socket.io-client/node_modules/debug/browser.js
generated
vendored
Normal file
177
node_modules/socket.io-client/node_modules/debug/browser.js
generated
vendored
Normal file
@ -0,0 +1,177 @@
|
||||
|
||||
/**
|
||||
* This is the web browser implementation of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = require('./debug');
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
exports.storage = 'undefined' != typeof chrome
|
||||
&& 'undefined' != typeof chrome.storage
|
||||
? chrome.storage.local
|
||||
: localstorage();
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [
|
||||
'lightseagreen',
|
||||
'forestgreen',
|
||||
'goldenrod',
|
||||
'dodgerblue',
|
||||
'darkorchid',
|
||||
'crimson'
|
||||
];
|
||||
|
||||
/**
|
||||
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
||||
* and the Firebug extension (any Firefox version) are known
|
||||
* to support "%c" CSS customizations.
|
||||
*
|
||||
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
||||
*/
|
||||
|
||||
function useColors() {
|
||||
// is webkit? http://stackoverflow.com/a/16459606/376773
|
||||
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
||||
return (typeof document !== 'undefined' && 'WebkitAppearance' in document.documentElement.style) ||
|
||||
// is firebug? http://stackoverflow.com/a/398120/376773
|
||||
(window.console && (console.firebug || (console.exception && console.table))) ||
|
||||
// is firefox >= v31?
|
||||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
||||
(navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
||||
*/
|
||||
|
||||
exports.formatters.j = function(v) {
|
||||
try {
|
||||
return JSON.stringify(v);
|
||||
} catch (err) {
|
||||
return '[UnexpectedJSONParseError]: ' + err.message;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Colorize log arguments if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs() {
|
||||
var args = arguments;
|
||||
var useColors = this.useColors;
|
||||
|
||||
args[0] = (useColors ? '%c' : '')
|
||||
+ this.namespace
|
||||
+ (useColors ? ' %c' : ' ')
|
||||
+ args[0]
|
||||
+ (useColors ? '%c ' : ' ')
|
||||
+ '+' + exports.humanize(this.diff);
|
||||
|
||||
if (!useColors) return args;
|
||||
|
||||
var c = 'color: ' + this.color;
|
||||
args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1));
|
||||
|
||||
// the final "%c" is somewhat tricky, because there could be other
|
||||
// arguments passed either before or after the %c, so we need to
|
||||
// figure out the correct index to insert the CSS into
|
||||
var index = 0;
|
||||
var lastC = 0;
|
||||
args[0].replace(/%[a-z%]/g, function(match) {
|
||||
if ('%%' === match) return;
|
||||
index++;
|
||||
if ('%c' === match) {
|
||||
// we only are interested in the *last* %c
|
||||
// (the user may have provided their own)
|
||||
lastC = index;
|
||||
}
|
||||
});
|
||||
|
||||
args.splice(lastC, 0, c);
|
||||
return args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `console.log()` when available.
|
||||
* No-op when `console.log` is not a "function".
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function log() {
|
||||
// this hackery is required for IE8/9, where
|
||||
// the `console.log` function doesn't have 'apply'
|
||||
return 'object' === typeof console
|
||||
&& console.log
|
||||
&& Function.prototype.apply.call(console.log, console, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function save(namespaces) {
|
||||
try {
|
||||
if (null == namespaces) {
|
||||
exports.storage.removeItem('debug');
|
||||
} else {
|
||||
exports.storage.debug = namespaces;
|
||||
}
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function load() {
|
||||
var r;
|
||||
try {
|
||||
return exports.storage.debug;
|
||||
} catch(e) {}
|
||||
|
||||
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
||||
if (typeof process !== 'undefined' && 'env' in process) {
|
||||
return process.env.DEBUG;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable namespaces listed in `localStorage.debug` initially.
|
||||
*/
|
||||
|
||||
exports.enable(load());
|
||||
|
||||
/**
|
||||
* Localstorage attempts to return the localstorage.
|
||||
*
|
||||
* This is necessary because safari throws
|
||||
* when a user disables cookies/localstorage
|
||||
* and you attempt to access it.
|
||||
*
|
||||
* @return {LocalStorage}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function localstorage(){
|
||||
try {
|
||||
return window.localStorage;
|
||||
} catch (e) {}
|
||||
}
|
19
node_modules/socket.io-client/node_modules/debug/component.json
generated
vendored
Normal file
19
node_modules/socket.io-client/node_modules/debug/component.json
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "debug",
|
||||
"repo": "visionmedia/debug",
|
||||
"description": "small debugging utility",
|
||||
"version": "2.3.3",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"log",
|
||||
"debugger"
|
||||
],
|
||||
"main": "browser.js",
|
||||
"scripts": [
|
||||
"browser.js",
|
||||
"debug.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"rauchg/ms.js": "0.7.1"
|
||||
}
|
||||
}
|
200
node_modules/socket.io-client/node_modules/debug/debug.js
generated
vendored
Normal file
200
node_modules/socket.io-client/node_modules/debug/debug.js
generated
vendored
Normal file
@ -0,0 +1,200 @@
|
||||
|
||||
/**
|
||||
* This is the common logic for both the Node.js and web browser
|
||||
* implementations of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = debug.debug = debug;
|
||||
exports.coerce = coerce;
|
||||
exports.disable = disable;
|
||||
exports.enable = enable;
|
||||
exports.enabled = enabled;
|
||||
exports.humanize = require('ms');
|
||||
|
||||
/**
|
||||
* The currently active debug mode names, and names to skip.
|
||||
*/
|
||||
|
||||
exports.names = [];
|
||||
exports.skips = [];
|
||||
|
||||
/**
|
||||
* Map of special "%n" handling functions, for the debug "format" argument.
|
||||
*
|
||||
* Valid key names are a single, lowercased letter, i.e. "n".
|
||||
*/
|
||||
|
||||
exports.formatters = {};
|
||||
|
||||
/**
|
||||
* Previously assigned color.
|
||||
*/
|
||||
|
||||
var prevColor = 0;
|
||||
|
||||
/**
|
||||
* Previous log timestamp.
|
||||
*/
|
||||
|
||||
var prevTime;
|
||||
|
||||
/**
|
||||
* Select a color.
|
||||
*
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function selectColor() {
|
||||
return exports.colors[prevColor++ % exports.colors.length];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a debugger with the given `namespace`.
|
||||
*
|
||||
* @param {String} namespace
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function debug(namespace) {
|
||||
|
||||
// define the `disabled` version
|
||||
function disabled() {
|
||||
}
|
||||
disabled.enabled = false;
|
||||
|
||||
// define the `enabled` version
|
||||
function enabled() {
|
||||
|
||||
var self = enabled;
|
||||
|
||||
// set `diff` timestamp
|
||||
var curr = +new Date();
|
||||
var ms = curr - (prevTime || curr);
|
||||
self.diff = ms;
|
||||
self.prev = prevTime;
|
||||
self.curr = curr;
|
||||
prevTime = curr;
|
||||
|
||||
// add the `color` if not set
|
||||
if (null == self.useColors) self.useColors = exports.useColors();
|
||||
if (null == self.color && self.useColors) self.color = selectColor();
|
||||
|
||||
var args = new Array(arguments.length);
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
|
||||
args[0] = exports.coerce(args[0]);
|
||||
|
||||
if ('string' !== typeof args[0]) {
|
||||
// anything else let's inspect with %o
|
||||
args = ['%o'].concat(args);
|
||||
}
|
||||
|
||||
// apply any `formatters` transformations
|
||||
var index = 0;
|
||||
args[0] = args[0].replace(/%([a-z%])/g, function(match, format) {
|
||||
// if we encounter an escaped % then don't increase the array index
|
||||
if (match === '%%') return match;
|
||||
index++;
|
||||
var formatter = exports.formatters[format];
|
||||
if ('function' === typeof formatter) {
|
||||
var val = args[index];
|
||||
match = formatter.call(self, val);
|
||||
|
||||
// now we need to remove `args[index]` since it's inlined in the `format`
|
||||
args.splice(index, 1);
|
||||
index--;
|
||||
}
|
||||
return match;
|
||||
});
|
||||
|
||||
// apply env-specific formatting
|
||||
args = exports.formatArgs.apply(self, args);
|
||||
|
||||
var logFn = enabled.log || exports.log || console.log.bind(console);
|
||||
logFn.apply(self, args);
|
||||
}
|
||||
enabled.enabled = true;
|
||||
|
||||
var fn = exports.enabled(namespace) ? enabled : disabled;
|
||||
|
||||
fn.namespace = namespace;
|
||||
|
||||
return fn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables a debug mode by namespaces. This can include modes
|
||||
* separated by a colon and wildcards.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function enable(namespaces) {
|
||||
exports.save(namespaces);
|
||||
|
||||
var split = (namespaces || '').split(/[\s,]+/);
|
||||
var len = split.length;
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (!split[i]) continue; // ignore empty strings
|
||||
namespaces = split[i].replace(/[\\^$+?.()|[\]{}]/g, '\\$&').replace(/\*/g, '.*?');
|
||||
if (namespaces[0] === '-') {
|
||||
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
||||
} else {
|
||||
exports.names.push(new RegExp('^' + namespaces + '$'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable debug output.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function disable() {
|
||||
exports.enable('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given mode name is enabled, false otherwise.
|
||||
*
|
||||
* @param {String} name
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function enabled(name) {
|
||||
var i, len;
|
||||
for (i = 0, len = exports.skips.length; i < len; i++) {
|
||||
if (exports.skips[i].test(name)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (i = 0, len = exports.names.length; i < len; i++) {
|
||||
if (exports.names[i].test(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Coerce `val`.
|
||||
*
|
||||
* @param {Mixed} val
|
||||
* @return {Mixed}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function coerce(val) {
|
||||
if (val instanceof Error) return val.stack || val.message;
|
||||
return val;
|
||||
}
|
10
node_modules/socket.io-client/node_modules/debug/index.js
generated
vendored
Normal file
10
node_modules/socket.io-client/node_modules/debug/index.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Detect Electron renderer process, which is node, but we should
|
||||
* treat as a browser.
|
||||
*/
|
||||
|
||||
if (typeof process !== 'undefined' && process.type === 'renderer') {
|
||||
module.exports = require('./browser.js');
|
||||
} else {
|
||||
module.exports = require('./node.js');
|
||||
}
|
213
node_modules/socket.io-client/node_modules/debug/node.js
generated
vendored
Normal file
213
node_modules/socket.io-client/node_modules/debug/node.js
generated
vendored
Normal file
@ -0,0 +1,213 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var tty = require('tty');
|
||||
var util = require('util');
|
||||
|
||||
/**
|
||||
* This is the Node.js implementation of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = require('./debug');
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [6, 2, 3, 4, 5, 1];
|
||||
|
||||
/**
|
||||
* The file descriptor to write the `debug()` calls to.
|
||||
* Set the `DEBUG_FD` env variable to override with another value. i.e.:
|
||||
*
|
||||
* $ DEBUG_FD=3 node script.js 3>debug.log
|
||||
*/
|
||||
|
||||
var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
|
||||
var stream = 1 === fd ? process.stdout :
|
||||
2 === fd ? process.stderr :
|
||||
createWritableStdioStream(fd);
|
||||
|
||||
/**
|
||||
* Is stdout a TTY? Colored output is enabled when `true`.
|
||||
*/
|
||||
|
||||
function useColors() {
|
||||
var debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase();
|
||||
if (0 === debugColors.length) {
|
||||
return tty.isatty(fd);
|
||||
} else {
|
||||
return '0' !== debugColors
|
||||
&& 'no' !== debugColors
|
||||
&& 'false' !== debugColors
|
||||
&& 'disabled' !== debugColors;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Map %o to `util.inspect()`, since Node doesn't do that out of the box.
|
||||
*/
|
||||
|
||||
var inspect = (4 === util.inspect.length ?
|
||||
// node <= 0.8.x
|
||||
function (v, colors) {
|
||||
return util.inspect(v, void 0, void 0, colors);
|
||||
} :
|
||||
// node > 0.8.x
|
||||
function (v, colors) {
|
||||
return util.inspect(v, { colors: colors });
|
||||
}
|
||||
);
|
||||
|
||||
exports.formatters.o = exports.formatters.O = function(v) {
|
||||
return inspect(v, this.useColors)
|
||||
.replace(/\s*\n\s*/g, ' ');
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds ANSI color escape codes if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs() {
|
||||
var len = arguments.length;
|
||||
var args = new Array(len);
|
||||
var useColors = this.useColors;
|
||||
var name = this.namespace;
|
||||
for (var i = 0; i < len; i++) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
|
||||
if (useColors) {
|
||||
var c = this.color;
|
||||
|
||||
args[0] = ' \u001b[3' + c + ';1m' + name + ' '
|
||||
+ '\u001b[0m'
|
||||
+ args[0];
|
||||
args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
|
||||
} else {
|
||||
args[0] = new Date().toUTCString()
|
||||
+ ' ' + name + ' ' + args[0];
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `console.error()` with the specified arguments.
|
||||
*/
|
||||
|
||||
function log() {
|
||||
return stream.write(util.format.apply(this, arguments) + '\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function save(namespaces) {
|
||||
if (null == namespaces) {
|
||||
// If you set a process.env field to null or undefined, it gets cast to the
|
||||
// string 'null' or 'undefined'. Just delete instead.
|
||||
delete process.env.DEBUG;
|
||||
} else {
|
||||
process.env.DEBUG = namespaces;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function load() {
|
||||
return process.env.DEBUG;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copied from `node/src/node.js`.
|
||||
*
|
||||
* XXX: It's lame that node doesn't expose this API out-of-the-box. It also
|
||||
* relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
|
||||
*/
|
||||
|
||||
function createWritableStdioStream (fd) {
|
||||
var stream;
|
||||
var tty_wrap = process.binding('tty_wrap');
|
||||
|
||||
// Note stream._type is used for test-module-load-list.js
|
||||
|
||||
switch (tty_wrap.guessHandleType(fd)) {
|
||||
case 'TTY':
|
||||
stream = new tty.WriteStream(fd);
|
||||
stream._type = 'tty';
|
||||
|
||||
// Hack to have stream not keep the event loop alive.
|
||||
// See https://github.com/joyent/node/issues/1726
|
||||
if (stream._handle && stream._handle.unref) {
|
||||
stream._handle.unref();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'FILE':
|
||||
var fs = require('fs');
|
||||
stream = new fs.SyncWriteStream(fd, { autoClose: false });
|
||||
stream._type = 'fs';
|
||||
break;
|
||||
|
||||
case 'PIPE':
|
||||
case 'TCP':
|
||||
var net = require('net');
|
||||
stream = new net.Socket({
|
||||
fd: fd,
|
||||
readable: false,
|
||||
writable: true
|
||||
});
|
||||
|
||||
// FIXME Should probably have an option in net.Socket to create a
|
||||
// stream from an existing fd which is writable only. But for now
|
||||
// we'll just add this hack and set the `readable` member to false.
|
||||
// Test: ./node test/fixtures/echo.js < /etc/passwd
|
||||
stream.readable = false;
|
||||
stream.read = null;
|
||||
stream._type = 'pipe';
|
||||
|
||||
// FIXME Hack to have stream not keep the event loop alive.
|
||||
// See https://github.com/joyent/node/issues/1726
|
||||
if (stream._handle && stream._handle.unref) {
|
||||
stream._handle.unref();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Probably an error on in uv_guess_handle()
|
||||
throw new Error('Implement me. Unknown stream file type!');
|
||||
}
|
||||
|
||||
// For supporting legacy API we put the FD here.
|
||||
stream.fd = fd;
|
||||
|
||||
stream._isStdio = true;
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable namespaces listed in `process.env.DEBUG` initially.
|
||||
*/
|
||||
|
||||
exports.enable(load());
|
113
node_modules/socket.io-client/node_modules/debug/package.json
generated
vendored
Normal file
113
node_modules/socket.io-client/node_modules/debug/package.json
generated
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"debug@2.3.3",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\socket.io-client"
|
||||
]
|
||||
],
|
||||
"_from": "debug@2.3.3",
|
||||
"_id": "debug@2.3.3",
|
||||
"_inCache": true,
|
||||
"_location": "/socket.io-client/debug",
|
||||
"_nodeVersion": "7.0.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/debug-2.3.3.tgz_1479585558307_0.03629564819857478"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "nathan@tootallnate.net",
|
||||
"name": "tootallnate"
|
||||
},
|
||||
"_npmVersion": "3.10.8",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "debug",
|
||||
"raw": "debug@2.3.3",
|
||||
"rawSpec": "2.3.3",
|
||||
"scope": null,
|
||||
"spec": "2.3.3",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/socket.io-client"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz",
|
||||
"_shasum": "40c453e67e6e13c901ddec317af8986cda9eff8c",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "debug@2.3.3",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\socket.io-client",
|
||||
"author": {
|
||||
"email": "tj@vision-media.ca",
|
||||
"name": "TJ Holowaychuk"
|
||||
},
|
||||
"browser": "./browser.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/visionmedia/debug/issues"
|
||||
},
|
||||
"component": {
|
||||
"scripts": {
|
||||
"debug/debug.js": "debug.js",
|
||||
"debug/index.js": "browser.js"
|
||||
}
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Nathan Rajlich",
|
||||
"email": "nathan@tootallnate.net",
|
||||
"url": "http://n8.io"
|
||||
},
|
||||
{
|
||||
"name": "Andrew Rhyne",
|
||||
"email": "rhyneandrew@gmail.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"ms": "0.7.2"
|
||||
},
|
||||
"description": "small debugging utility",
|
||||
"devDependencies": {
|
||||
"browserify": "9.0.3",
|
||||
"mocha": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "40c453e67e6e13c901ddec317af8986cda9eff8c",
|
||||
"tarball": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz"
|
||||
},
|
||||
"gitHead": "3ad8df75614cd4306709ad73519fd579971fb8d9",
|
||||
"homepage": "https://github.com/visionmedia/debug#readme",
|
||||
"installable": true,
|
||||
"keywords": [
|
||||
"debug",
|
||||
"debugger",
|
||||
"log"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "kolban",
|
||||
"email": "kolban1@kolban.com"
|
||||
},
|
||||
{
|
||||
"name": "thebigredgeek",
|
||||
"email": "rhyneandrew@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "tjholowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
{
|
||||
"name": "tootallnate",
|
||||
"email": "nathan@tootallnate.net"
|
||||
}
|
||||
],
|
||||
"name": "debug",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/visionmedia/debug.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"version": "2.3.3"
|
||||
}
|
617
node_modules/socket.io-client/node_modules/engine.io-client/History.md
generated
vendored
Normal file
617
node_modules/socket.io-client/node_modules/engine.io-client/History.md
generated
vendored
Normal file
@ -0,0 +1,617 @@
|
||||
|
||||
1.8.0 / 2016-11-20
|
||||
===================
|
||||
|
||||
* [fix] Fixed regression creating connection over https from node (#513)
|
||||
* [fix] Fixed regression creating connection over wss from node (#514)
|
||||
* [feature] Enable definition of timeouts for xhr-polling (#456)
|
||||
* [feature] Added flag forceNode to override the normal behavior of prefering Browser based implementations. (#469)
|
||||
* [feature] add localAddress option (#487)
|
||||
* [chore] update dependencies (#516)
|
||||
* [chore] Speed up lint by avoiding '**/*.js' matching pattern (#517)
|
||||
* [chore] Bump debug to version 2.3.3 (#520)
|
||||
|
||||
1.7.2 / 2016-10-24
|
||||
===================
|
||||
|
||||
* [fix] Set accept header to */* to support react app proxy (#508)
|
||||
* [fix] remove a workaround for ios (#465)
|
||||
* [fix] onPacket now emits data on 'closing' state as well (#484)
|
||||
* [fix] Obfuscate `ActiveXObject` occurrences (#509)
|
||||
* [docs] Add missing `onlyBinaryUpgrades` option in the docs (#510)
|
||||
* [chore] Add Github issue and PR templates (#511)
|
||||
|
||||
1.7.1 / 2016-10-20
|
||||
===================
|
||||
|
||||
* [fix] Define "requestsCount" var and "requests" hash unconditionally (#490)
|
||||
* [perf] Add all properties to the socket in the constructor (#488)
|
||||
* [chore] Update zuul browser settings (#504)
|
||||
* [chore] Bump engine.io-parser to 1.3.1 (#505)
|
||||
* [chore] Use more-specific imports for StealJS compatibility (#467)
|
||||
|
||||
1.7.0 / 2016-10-05
|
||||
===================
|
||||
|
||||
* [fix] Revert "default `rejectUnauthorized` to `true`" (#496)
|
||||
* [fix] Use xhr.responseText if xhr.response is not provided (#483)
|
||||
* [fix] Fix issue with errors during WebSocket creation not being caught (#475)
|
||||
* [style] Add missing semi-colon (#501)
|
||||
* [chore] Add gulp & babel in the build process (#455)
|
||||
* [chore] Add eslint (#458)
|
||||
* [chore] Bump zuul (#464)
|
||||
* [chore] Remove unused submodule (#466)
|
||||
* [chore] Bumping ws to 1.1.1 (#478)
|
||||
* [chore] Update zuul browser settings following EOL notices (#486)
|
||||
* [chore] Bump engine.io-parser (#492)
|
||||
* [chore] Make the build status badge point towards master (#497)
|
||||
* [chore] Bump zuul to 3.11.0 & zuul-ngrok to 4.0.0 (#498)
|
||||
* [chore] Restrict files included in npm package (#499)
|
||||
|
||||
1.6.11 / 2016-06-23
|
||||
===================
|
||||
|
||||
* bump version
|
||||
|
||||
1.6.10 / 2016-06-23
|
||||
===================
|
||||
|
||||
* bump version
|
||||
|
||||
1.6.9 / 2016-05-02
|
||||
==================
|
||||
|
||||
* default `rejectUnauthorized` to `true`
|
||||
|
||||
1.6.8 / 2016-01-25
|
||||
==================
|
||||
|
||||
* safely resolve `ws` module
|
||||
|
||||
1.6.7 / 2016-01-10
|
||||
==================
|
||||
|
||||
* prevent `ws` from being added to the bundle
|
||||
* added jsonp fix for when no `<script>` is found
|
||||
|
||||
1.6.6 / 2016-01-07
|
||||
==================
|
||||
|
||||
* support: add fallback to `global` for nativescript [@ligaz]
|
||||
* exclude `ws` instead of ignoring it from build [@lpinca]
|
||||
|
||||
1.6.5 / 2016-01-05
|
||||
==================
|
||||
|
||||
* package: bump `ws` for sec advisory
|
||||
|
||||
1.6.4 / 2015-12-04
|
||||
==================
|
||||
|
||||
* ipv6 url support
|
||||
* README: fix the description of the `timestampRequests` option
|
||||
* transports: use `yeast` to generate the cache busting id
|
||||
* fix arraybuffer > base64 for binary sends
|
||||
|
||||
1.6.3 / 2015-12-01
|
||||
==================
|
||||
|
||||
* remove compress option from control packets
|
||||
* threshold for permessage-deflate
|
||||
|
||||
1.6.2 / 2015-11-30
|
||||
==================
|
||||
|
||||
* package: bump `ws` for memory fix with compression
|
||||
* fix response parsing error for polling (unused)
|
||||
|
||||
1.6.1 / 2015-11-28
|
||||
==================
|
||||
|
||||
* fix packet options that `ws` changes [Nibbler999]
|
||||
* package: use published `engine.io-parser`
|
||||
|
||||
1.6.0 / 2015-11-28
|
||||
==================
|
||||
|
||||
* test with travis containers
|
||||
* socket: remove duplicate declaration (fixes #434)
|
||||
* package: bump `debug` (fixes #433)
|
||||
* bump zuul and zuul-ngrok
|
||||
* package: fix repository url
|
||||
* bump `ws` for several improvements
|
||||
* fix rejectUnauthorized bug
|
||||
* websocket: improve firing of `drain` in websocket transport
|
||||
* socket: clean up buffers right after `close` event
|
||||
* change semantics of the write callback for polling
|
||||
(fire upon flush instead drain)
|
||||
* socket: fix host parsing for IPv6 URLs
|
||||
* socket: handle parser errors appropriately
|
||||
* expose `ping` and `pong` events
|
||||
* enable `supportsBinary` when running as a node client
|
||||
* introduce `extraHeaders` support
|
||||
* fix error when passing `WebSocket#send` second argument on Safari
|
||||
* support compression
|
||||
|
||||
1.5.4 / 2015-09-09
|
||||
==================
|
||||
|
||||
* package: bump `engine.io-parser`
|
||||
|
||||
1.5.3 / 2015-09-09
|
||||
==================
|
||||
|
||||
* package: bump `ws` to fix node 0.4.0
|
||||
|
||||
1.5.2 / 2015-07-09
|
||||
==================
|
||||
|
||||
* package: bump `ws` to fix windows build issues
|
||||
|
||||
1.5.1 / 2015-01-19
|
||||
==================
|
||||
|
||||
* do not rely on `git(1)` for dep, point to tarball instead
|
||||
|
||||
1.5.0 / 2015-01-18
|
||||
==================
|
||||
|
||||
* package: bump `engine.io-parser`
|
||||
* fix IE tests firing too many connections [rase-]
|
||||
* fix default port detection when host is specified [defunctzombie]
|
||||
* add support for custom SSL options in constructor [rase-]
|
||||
* only call xhr.abort() on error cases in `polling-xhr` [samcday]
|
||||
|
||||
1.4.3 / 2014-11-21
|
||||
==================
|
||||
|
||||
* support: make the build system work with the latest browserify
|
||||
* test: remove test with partial browser support
|
||||
* Fixed calls to addEventListener in old browsers
|
||||
|
||||
1.4.2 / 2014-10-27
|
||||
==================
|
||||
|
||||
* remove invalid value for strict mode
|
||||
* IE10 should prefer using XHR2 over XDR because it's safer
|
||||
* fixed transport close deferring logic [nkzawa]
|
||||
* wait for buffer to be drained before closing [nkzawa]
|
||||
|
||||
1.4.1 / 2014-10-03
|
||||
==================
|
||||
|
||||
* Fixed "jsonp polling iframe removal error"
|
||||
* Move ws upgrade needing connection tests to a block checking browser support.
|
||||
* check `readyState` in `sendPacket` and close on `upgradeError` too
|
||||
* defer close while upgrading a transport
|
||||
|
||||
1.4.0 / 2014-09-03
|
||||
==================
|
||||
|
||||
* add matrix support for travis runs.
|
||||
* add `enablesXDR` option to turn on `XDomainRequest`
|
||||
* package: bump `browserify`
|
||||
* package: bump `engine.io-parser`
|
||||
* style and close socket after assert
|
||||
* add support for `jsonp` option to turn it off
|
||||
|
||||
1.3.1 / 2014-06-19
|
||||
==================
|
||||
|
||||
* transport: catch utf8 decode errors
|
||||
|
||||
1.3.0 / 2014-06-13
|
||||
==================
|
||||
|
||||
* smaller inherits utility
|
||||
* fix a test for ws
|
||||
* upgrade emitter dep to not rely on tarball
|
||||
|
||||
1.2.2 / 2014-05-30
|
||||
==================
|
||||
|
||||
* package: bump `engine.io-parser` for binary utf8 fix
|
||||
|
||||
1.2.1 / 2014-05-22
|
||||
==================
|
||||
|
||||
* build
|
||||
|
||||
1.2.0 / 2014-05-18
|
||||
==================
|
||||
|
||||
* removed flashsocket, moving to userland
|
||||
* new build
|
||||
|
||||
1.1.1 / 2014-05-14
|
||||
==================
|
||||
|
||||
* jsonp-polling: fixed newline double escaping
|
||||
* package: bump parser
|
||||
* remove legacy Socket#onopen call
|
||||
* added tests for multibyte strings
|
||||
|
||||
1.1.0 / 2014-04-27
|
||||
==================
|
||||
|
||||
* bump zuul version
|
||||
* renamed removeAllListeners to cleanup
|
||||
* use inherits package instead of inherit
|
||||
* removed all references to util.js
|
||||
* fix if statement in FlashWS.ready method
|
||||
* polling-jsonp: prevent spurious errors from being emitted when the window is unloaded
|
||||
* polling-xhr: fix a comment and remove unneeded `document` reference
|
||||
* enforce cache busting for all user agents
|
||||
* JSONP and test fixes for fails in IE
|
||||
* package: bump `engine.io-parser`
|
||||
* polling-xhr: abort the request when the window is unloaded
|
||||
|
||||
1.0.5 / 2014-03-18
|
||||
==================
|
||||
|
||||
* package: bump `engine.io-parser` for android binary fix
|
||||
|
||||
1.0.4 / 2014-03-14
|
||||
==================
|
||||
|
||||
* no base64 encoding for no reason when using websockets
|
||||
|
||||
1.0.3 / 2014-03-12
|
||||
==================
|
||||
|
||||
* fix browserify
|
||||
|
||||
1.0.2 / 2014-03-12
|
||||
==================
|
||||
|
||||
* bump `engine.io-parser`
|
||||
* made `parseJSON` and `parseURI` from `util` their own modules [gkoren]
|
||||
* clean up tests
|
||||
* clean up browserify
|
||||
|
||||
1.0.1 / 2014-03-06
|
||||
==================
|
||||
|
||||
* package: bump `engine.io-parser`
|
||||
|
||||
1.0.0 / 2014-03-06
|
||||
==================
|
||||
|
||||
* run browserify without shims
|
||||
* emit socket upgrade event after upgrade done
|
||||
* better feature detection for XHR2
|
||||
* added `rememberUpgrade` option
|
||||
* binary support
|
||||
|
||||
0.9.0 / 2014-02-09
|
||||
==================
|
||||
|
||||
* Fix simple `host:port` URLs and IPV6 [bmalehorn]
|
||||
* Fix XHR cleanup method [poohlty]
|
||||
* Match semantics of `close` event with `WebSocket`. If an error occurs
|
||||
and `open` hadn't fired before, we still emit `close` as per
|
||||
WebSocket spec [mokesmokes].
|
||||
* Removed SPEC (now in `engine.io-protocol` repository)
|
||||
* Remove `Socket#open` docs (private API) [mokesmokes]
|
||||
|
||||
0.8.2 / 2014-01-18
|
||||
==================
|
||||
|
||||
* polling-xhr: avoid catching user-thrown errors
|
||||
* util: remove unused `hasCORS`
|
||||
* polling: remove deferring for faster startup (fixes #174)
|
||||
* engine now works perfectly on workers
|
||||
|
||||
0.8.1 / 2014-01-17
|
||||
==================
|
||||
|
||||
* package: bump debug to fix `localStorage` issue (fixes #213)
|
||||
* remove duplicate xmlhttprequest code
|
||||
* add iphone automated testing
|
||||
* bump zuul to 1.3.0 to improve tests performance
|
||||
* use invalid ip address for incorrect connection test
|
||||
* Fix GH-224, remove sockets array
|
||||
|
||||
0.8.0 / 2014-01-05
|
||||
==================
|
||||
|
||||
* socket: emit upgrade errors as `upgradeError` instead of `error`
|
||||
|
||||
0.7.14 / 2014-01-01
|
||||
===================
|
||||
|
||||
* test: increase timeouts for network tests
|
||||
* test: whitelist globals
|
||||
* test: improve socket closing test
|
||||
* polling: improve url timestamp for ie11 and allow force disabling
|
||||
* polling-xhr: handle errors for xhr creation (fixes `access denied` issues)
|
||||
* polling-xhr: style
|
||||
* socket: more instrumentation for transport creation
|
||||
* socket: allow explicit `false` for `timestampRequests`
|
||||
* socket: accept `null` as first argument
|
||||
* Makefile: cleanup
|
||||
* .travis: deprecate 0.6
|
||||
|
||||
0.7.13 / 2013-12-20
|
||||
===================
|
||||
|
||||
* use `jsonp` in favor of `XDomainRequest` to preserve `Cookie`
|
||||
headers in all situations [3rd-eden] (fixes #217)
|
||||
* run zuul tests after node tests [defunctzombie]
|
||||
* add zuul support for easier browser testing [defunctzombie]
|
||||
|
||||
0.7.12 / 2013-11-11
|
||||
===================
|
||||
|
||||
* engine.io: updated build to fix WebSocket constructor issue
|
||||
* package: move browserify into devDeps
|
||||
|
||||
0.7.11 / 2013-11-06
|
||||
===================
|
||||
|
||||
* AMD support
|
||||
* Makefile: build now smaller thanks to browserify
|
||||
* add browserify support
|
||||
|
||||
0.7.10 / 2013-10-28
|
||||
===================
|
||||
|
||||
* fixed issue which prevented IE9 and under to pass Cookies to server during handshake
|
||||
* package: update "ws" to v0.4.31
|
||||
* fixed - there is no host property only hostname
|
||||
* fixed - flash socket creation
|
||||
* fixed - emit errors thrown by xhr.send()
|
||||
|
||||
0.7.9 / 2013-08-30
|
||||
==================
|
||||
|
||||
* websocket: pass `undefined` as the WebSocket "protocols"
|
||||
|
||||
0.7.8 / 2013-08-30
|
||||
==================
|
||||
|
||||
* package: update "ws"
|
||||
|
||||
0.7.7 / 2013-08-30
|
||||
==================
|
||||
|
||||
* package: bump ws to 0.4.30
|
||||
* websocket: no more env sniffing, just require `ws` [TooTallNate]
|
||||
* websocket: remove the "bufferedAmount" checking logic [TooTallNate]
|
||||
|
||||
0.7.6 / 2013-08-30
|
||||
==================
|
||||
|
||||
* package: revert ws to avoid upgrade fail now
|
||||
|
||||
0.7.5 / 2013-08-30
|
||||
==================
|
||||
|
||||
* package: bump ws to 0.4.30
|
||||
|
||||
0.7.4 / 2013-08-25
|
||||
==================
|
||||
|
||||
* package: rolling back to `ws` `0.4.25` due to disconnection bug
|
||||
|
||||
0.7.3 / 2013-08-23
|
||||
==================
|
||||
|
||||
* noop bump
|
||||
|
||||
0.7.2 / 2013-08-23
|
||||
==================
|
||||
|
||||
* transports: fix WebSocket transport in the web browser (again)
|
||||
|
||||
0.7.1 / 2013-08-23
|
||||
==================
|
||||
|
||||
* transports: fix WebSocket transport in the web browser
|
||||
* package: upgrade "ws" to v0.4.29
|
||||
|
||||
0.7.0 / 2013-08-23
|
||||
==================
|
||||
|
||||
* socket: add `agent` option
|
||||
* package: point "xmlhttprequest" to our LearnBoost fork for agent support
|
||||
* package: specify a newer version of "ws" that includes `agent` support
|
||||
* util: use "component/has-cors"
|
||||
* transport: fix whitespace
|
||||
* util: use "component/global"
|
||||
* package: Add repository field to readme
|
||||
* socket: Don't lose packets writen during upgrade after a re-open
|
||||
* socket: use a consistent "debug" name for socket.js
|
||||
* package: Update emitter dep to 1.0.1 for old IE support
|
||||
|
||||
0.6.3 / 2013-06-21
|
||||
==================
|
||||
|
||||
* fix check readyState in polling transport (Naoyuki Kanezawa)
|
||||
* use http url in npm dependencies for emitter (Eric Schoffstall)
|
||||
|
||||
0.6.2 / 2013-06-15
|
||||
==================
|
||||
|
||||
* transports: improve polling orderly close (fixes #164)
|
||||
* socket: ignore further transport communication upon `onClose`
|
||||
* socket: added missing `socket#onerror` support
|
||||
* socket: don't call `socket#onclose` if previous state was not `open`
|
||||
* transports: fix iOS5 crash issue
|
||||
* Makefile: extra precaution when building to avoid 0.6.0 build problem
|
||||
|
||||
0.6.1 / 2013-06-06
|
||||
==================
|
||||
|
||||
* engine.io: fixed build
|
||||
|
||||
0.6.0 / 2013-05-31
|
||||
==================
|
||||
|
||||
* does not emit close on incorrect socket connection
|
||||
* use indexof component for ie8 and below
|
||||
* improved x-domain handling
|
||||
* introduce public `ping` api
|
||||
* added drain event
|
||||
* fix `flush` and `flushComplete` events
|
||||
* fixed `drain` bug splicing with upgrading
|
||||
* add support for callbacks with socket.send()
|
||||
|
||||
0.5.0 / 2013-03-16
|
||||
==================
|
||||
|
||||
* socket: implement qs support for `string`
|
||||
* added query.EIO to take protocol version from parser
|
||||
* use istanbul for code coverage
|
||||
* integrated engine.io-protocol 0.3.0
|
||||
* updated ws
|
||||
* fixed JSONPPolling iframe removal error
|
||||
* changed error message to match xhr error message on jsonp transport script tag
|
||||
* Added onerror handler for script tag in jsonp transport
|
||||
* remove uid qs
|
||||
* Added missing colon in payload. Thanks @lsm
|
||||
|
||||
0.4.3 / 2013-02-08
|
||||
==================
|
||||
|
||||
* package: removed unusued `parser.js`
|
||||
|
||||
0.4.2 / 2013-02-08
|
||||
==================
|
||||
|
||||
* polling-jsonp: fix ie6 JSONP on SSL
|
||||
* close also if socket.readyState is on "opening"
|
||||
* parser.js: removed the file package.json: added the engine.io-parser dependency everything else: switched to engine.io-parser
|
||||
* fix "TypeError: Object #<Object> has no method 'global'"
|
||||
* client now ignores unsupported upgrades
|
||||
|
||||
0.4.1 / 2013-01-18
|
||||
==================
|
||||
|
||||
* do not shadow global XMLHttpRequest
|
||||
* socket: added `data` event (as synonym to `message`)
|
||||
* socket: remove `resource` and fix `path`
|
||||
* socket: fixed access to `opts`
|
||||
* test: fixed transports tests
|
||||
* socket: constructor can accept uri/opts simultaneously
|
||||
* SPEC: simplified: removed resource from SPEC
|
||||
* socket: proper `host`/`hostname` support
|
||||
* socket: ensure `onclose` idempotency
|
||||
* socket: added `onerror` instrumentation
|
||||
* socket: fix style
|
||||
* use window to detect platform and fix global reference
|
||||
* *: fix references to `global` (fixes #79)
|
||||
|
||||
0.4.0 / 2012-12-09
|
||||
==================
|
||||
|
||||
* *: now based on `component(1)`
|
||||
* *: module now exports `Socket`
|
||||
* socket: export constructors, utils and `protocol`
|
||||
* *: implemented `emitter` component
|
||||
* *: removed browserbuild and preprocessor instructions
|
||||
|
||||
0.3.10 / 2012-12-03
|
||||
===================
|
||||
|
||||
* socket: fix closing the socket in an `open` listener [mmastrac]
|
||||
* socket: perform ping interval/timer cleanup [mmastrac]
|
||||
* fix SPEC (packages -> packets) [jxck]
|
||||
* socket: handle probe's transport errors [indutny]
|
||||
|
||||
0.3.9 / 2012-10-23
|
||||
==================
|
||||
|
||||
* socket: fix `hostname` instead of `host`
|
||||
* socket: avoid duplicate `port` defaults
|
||||
|
||||
0.3.8 / 2012-10-23
|
||||
==================
|
||||
|
||||
* socket: introduce introspection hooks
|
||||
* socket: introduced `host` and `port` `location` defaults
|
||||
* flashsocket: obfuscate activex (fixes #31)
|
||||
* README: documented reconnect (closes #45)
|
||||
* socket: unset `id` upon close
|
||||
* socket: clear transport listeners upon force close
|
||||
|
||||
0.3.7 / 2012-10-21
|
||||
==================
|
||||
|
||||
* fix `version` [quackingduck]
|
||||
* ping timeout gets reset upon any packet received [indutny]
|
||||
* timeout fixes [cadorn, indutny]
|
||||
* transport: fix xdomain detection in absence of location.port (GH-38)
|
||||
* socket: fix passing `false` as secure getting overridden
|
||||
* socket: default `secure` to `true` for SSL-served pages
|
||||
* socket: fix default port for SSL when `secure` is not supplied
|
||||
|
||||
0.3.6 / 2012-10-16
|
||||
==================
|
||||
|
||||
* socket: reset timeout on any incoming data [indutny]
|
||||
|
||||
0.3.5 / 2012-10-14
|
||||
==================
|
||||
|
||||
* new build
|
||||
|
||||
0.3.4 / 2012-10-14
|
||||
==================
|
||||
|
||||
* package: fix `component` exports
|
||||
|
||||
0.3.3 / 2012-10-10
|
||||
==================
|
||||
|
||||
* socket: fix `secure` default value discovery [quackingduck]
|
||||
|
||||
0.3.2 / 2012-10-08
|
||||
==================
|
||||
|
||||
* Bump
|
||||
|
||||
0.3.1 / 2012-10-08
|
||||
==================
|
||||
|
||||
* socket: added `write` alias for `send`
|
||||
* package: added `component`
|
||||
|
||||
0.3.0 / 2012-09-04
|
||||
==================
|
||||
|
||||
* IE's XDomainRequest cannot do requests that go from HTTPS to HTTP or HTTP to HTTPS [mixu]
|
||||
* Switch to client-initiated ping, and set interval in handshake [cadorn]
|
||||
|
||||
0.2.2 / 2012-08-26
|
||||
==================
|
||||
|
||||
* polling-jsonp: allow unneeded global leak (fixes #41)
|
||||
* polling-jsonp: allow for multiple eio's in the same page
|
||||
|
||||
0.2.1 / 2012-08-13
|
||||
==================
|
||||
|
||||
* Bump
|
||||
|
||||
0.2.0 / 2012-08-06
|
||||
==================
|
||||
|
||||
* polling: introduced `poll` and `pollComplete` (formerly `poll`) events
|
||||
|
||||
0.1.2 / 2012-08-02
|
||||
==================
|
||||
|
||||
* Bump
|
||||
|
||||
0.1.1 / 2012-08-01
|
||||
==================
|
||||
|
||||
* Added options for request timestamping
|
||||
* Made timestamp query param customizable
|
||||
* Added automatic timestamping for Android
|
||||
|
||||
0.1.0 / 2012-07-03
|
||||
==================
|
||||
|
||||
* Initial release.
|
22
node_modules/socket.io-client/node_modules/engine.io-client/LICENSE
generated
vendored
Normal file
22
node_modules/socket.io-client/node_modules/engine.io-client/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014-2015 Automattic <dev@cloudup.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
295
node_modules/socket.io-client/node_modules/engine.io-client/README.md
generated
vendored
Normal file
295
node_modules/socket.io-client/node_modules/engine.io-client/README.md
generated
vendored
Normal file
@ -0,0 +1,295 @@
|
||||
|
||||
# Engine.IO client
|
||||
|
||||
[](http://travis-ci.org/socketio/engine.io-client)
|
||||
[](http://badge.fury.io/js/engine.io-client)
|
||||
|
||||
This is the client for [Engine.IO](http://github.com/socketio/engine.io),
|
||||
the implementation of transport-based cross-browser/cross-device
|
||||
bi-directional communication layer for [Socket.IO](http://github.com/socketio/socket.io).
|
||||
|
||||
## How to use
|
||||
|
||||
### Standalone
|
||||
|
||||
You can find an `engine.io.js` file in this repository, which is a
|
||||
standalone build you can use as follows:
|
||||
|
||||
```html
|
||||
<script src="/path/to/engine.io.js"></script>
|
||||
<script>
|
||||
// eio = Socket
|
||||
var socket = eio('ws://localhost');
|
||||
socket.on('open', function(){
|
||||
socket.on('message', function(data){});
|
||||
socket.on('close', function(){});
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
### With browserify
|
||||
|
||||
Engine.IO is a commonjs module, which means you can include it by using
|
||||
`require` on the browser and package using [browserify](http://browserify.org/):
|
||||
|
||||
1. install the client package
|
||||
|
||||
```bash
|
||||
$ npm install engine.io-client
|
||||
```
|
||||
|
||||
1. write your app code
|
||||
|
||||
```js
|
||||
var socket = require('engine.io-client')('ws://localhost');
|
||||
socket.on('open', function(){
|
||||
socket.on('message', function(data){});
|
||||
socket.on('close', function(){});
|
||||
});
|
||||
```
|
||||
|
||||
1. build your app bundle
|
||||
|
||||
```bash
|
||||
$ browserify app.js > bundle.js
|
||||
```
|
||||
|
||||
1. include on your page
|
||||
|
||||
```html
|
||||
<script src="/path/to/bundle.js"></script>
|
||||
```
|
||||
|
||||
### Sending and receiving binary
|
||||
|
||||
```html
|
||||
<script src="/path/to/engine.io.js"></script>
|
||||
<script>
|
||||
var socket = new eio.Socket('ws://localhost/');
|
||||
socket.binaryType = 'blob';
|
||||
socket.on('open', function () {
|
||||
socket.send(new Int8Array(5));
|
||||
socket.on('message', function(blob){});
|
||||
socket.on('close', function(){ });
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
### Node.JS
|
||||
|
||||
Add `engine.io-client` to your `package.json` and then:
|
||||
|
||||
```js
|
||||
var socket = require('engine.io-client')('ws://localhost');
|
||||
socket.on('open', function(){
|
||||
socket.on('message', function(data){});
|
||||
socket.on('close', function(){});
|
||||
});
|
||||
```
|
||||
|
||||
### Node.js with certificates
|
||||
```js
|
||||
var opts = {
|
||||
key: fs.readFileSync('test/fixtures/client.key'),
|
||||
cert: fs.readFileSync('test/fixtures/client.crt'),
|
||||
ca: fs.readFileSync('test/fixtures/ca.crt')
|
||||
};
|
||||
|
||||
var socket = require('engine.io-client')('ws://localhost', opts);
|
||||
socket.on('open', function(){
|
||||
socket.on('message', function(data){});
|
||||
socket.on('close', function(){});
|
||||
});
|
||||
```
|
||||
|
||||
### Node.js with extraHeaders
|
||||
```js
|
||||
var opts = {
|
||||
extraHeaders: {
|
||||
'X-Custom-Header-For-My-Project': 'my-secret-access-token',
|
||||
'Cookie': 'user_session=NI2JlCKF90aE0sJZD9ZzujtdsUqNYSBYxzlTsvdSUe35ZzdtVRGqYFr0kdGxbfc5gUOkR9RGp20GVKza; path=/; expires=Tue, 07-Apr-2015 18:18:08 GMT; secure; HttpOnly'
|
||||
}
|
||||
};
|
||||
|
||||
var socket = require('engine.io-client')('ws://localhost', opts);
|
||||
socket.on('open', function(){
|
||||
socket.on('message', function(data){});
|
||||
socket.on('close', function(){});
|
||||
});
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- Lightweight
|
||||
- Runs on browser and node.js seamlessly
|
||||
- Transports are independent of `Engine`
|
||||
- Easy to debug
|
||||
- Easy to unit test
|
||||
- Runs inside HTML5 WebWorker
|
||||
- Can send and receive binary data
|
||||
- Receives as ArrayBuffer or Blob when in browser, and Buffer or ArrayBuffer
|
||||
in Node
|
||||
- When XHR2 or WebSockets are used, binary is emitted directly. Otherwise
|
||||
binary is encoded into base64 strings, and decoded when binary types are
|
||||
supported.
|
||||
- With browsers that don't support ArrayBuffer, an object { base64: true,
|
||||
data: dataAsBase64String } is emitted on the `message` event.
|
||||
|
||||
## API
|
||||
|
||||
### Socket
|
||||
|
||||
The client class. Mixes in [Emitter](http://github.com/component/emitter).
|
||||
Exposed as `eio` in the browser standalone build.
|
||||
|
||||
#### Properties
|
||||
|
||||
- `protocol` _(Number)_: protocol revision number
|
||||
- `binaryType` _(String)_ : can be set to 'arraybuffer' or 'blob' in browsers,
|
||||
and `buffer` or `arraybuffer` in Node. Blob is only used in browser if it's
|
||||
supported.
|
||||
|
||||
#### Events
|
||||
|
||||
- `open`
|
||||
- Fired upon successful connection.
|
||||
- `message`
|
||||
- Fired when data is received from the server.
|
||||
- **Arguments**
|
||||
- `String` | `ArrayBuffer`: utf-8 encoded data or ArrayBuffer containing
|
||||
binary data
|
||||
- `close`
|
||||
- Fired upon disconnection. In compliance with the WebSocket API spec, this event may be
|
||||
fired even if the `open` event does not occur (i.e. due to connection error or `close()`).
|
||||
- `error`
|
||||
- Fired when an error occurs.
|
||||
- `flush`
|
||||
- Fired upon completing a buffer flush
|
||||
- `drain`
|
||||
- Fired after `drain` event of transport if writeBuffer is empty
|
||||
- `upgradeError`
|
||||
- Fired if an error occurs with a transport we're trying to upgrade to.
|
||||
- `upgrade`
|
||||
- Fired upon upgrade success, after the new transport is set
|
||||
- `ping`
|
||||
- Fired upon _flushing_ a ping packet (ie: actual packet write out)
|
||||
- `pong`
|
||||
- Fired upon receiving a pong packet.
|
||||
|
||||
#### Methods
|
||||
|
||||
- **constructor**
|
||||
- Initializes the client
|
||||
- **Parameters**
|
||||
- `String` uri
|
||||
- `Object`: optional, options object
|
||||
- **Options**
|
||||
- `agent` (`http.Agent`): `http.Agent` to use, defaults to `false` (NodeJS only)
|
||||
- `upgrade` (`Boolean`): defaults to true, whether the client should try
|
||||
to upgrade the transport from long-polling to something better.
|
||||
- `forceJSONP` (`Boolean`): forces JSONP for polling transport.
|
||||
- `jsonp` (`Boolean`): determines whether to use JSONP when
|
||||
necessary for polling. If disabled (by settings to false) an error will
|
||||
be emitted (saying "No transports available") if no other transports
|
||||
are available. If another transport is available for opening a
|
||||
connection (e.g. WebSocket) that transport
|
||||
will be used instead.
|
||||
- `forceBase64` (`Boolean`): forces base 64 encoding for polling transport even when XHR2 responseType is available and WebSocket even if the used standard supports binary.
|
||||
- `enablesXDR` (`Boolean`): enables XDomainRequest for IE8 to avoid loading bar flashing with click sound. default to `false` because XDomainRequest has a flaw of not sending cookie.
|
||||
- `timestampRequests` (`Boolean`): whether to add the timestamp with each
|
||||
transport request. Note: polling requests are always stamped unless this
|
||||
option is explicitly set to `false` (`false`)
|
||||
- `timestampParam` (`String`): timestamp parameter (`t`)
|
||||
- `policyPort` (`Number`): port the policy server listens on (`843`)
|
||||
- `path` (`String`): path to connect to, default is `/engine.io`
|
||||
- `transports` (`Array`): a list of transports to try (in order).
|
||||
Defaults to `['polling', 'websocket']`. `Engine`
|
||||
always attempts to connect directly with the first one, provided the
|
||||
feature detection test for it passes.
|
||||
- `rememberUpgrade` (`Boolean`): defaults to false.
|
||||
If true and if the previous websocket connection to the server succeeded,
|
||||
the connection attempt will bypass the normal upgrade process and will initially
|
||||
try websocket. A connection attempt following a transport error will use the
|
||||
normal upgrade process. It is recommended you turn this on only when using
|
||||
SSL/TLS connections, or if you know that your network does not block websockets.
|
||||
- `pfx` (`String`): Certificate, Private key and CA certificates to use for SSL. Can be used in Node.js client environment to manually specify certificate information.
|
||||
- `key` (`String`): Private key to use for SSL. Can be used in Node.js client environment to manually specify certificate information.
|
||||
- `passphrase` (`String`): A string of passphrase for the private key or pfx. Can be used in Node.js client environment to manually specify certificate information.
|
||||
- `cert` (`String`): Public x509 certificate to use. Can be used in Node.js client environment to manually specify certificate information.
|
||||
- `ca` (`String`|`Array`): An authority certificate or array of authority certificates to check the remote host against.. Can be used in Node.js client environment to manually specify certificate information.
|
||||
- `ciphers` (`String`): A string describing the ciphers to use or exclude. Consult the [cipher format list](http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT) for details on the format. Can be used in Node.js client environment to manually specify certificate information.
|
||||
- `rejectUnauthorized` (`Boolean`): If true, the server certificate is verified against the list of supplied CAs. An 'error' event is emitted if verification fails. Verification happens at the connection level, before the HTTP request is sent. Can be used in Node.js client environment to manually specify certificate information.
|
||||
- `perMessageDeflate` (`Object|Boolean`): parameters of the WebSocket permessage-deflate extension
|
||||
(see [ws module](https://github.com/einaros/ws) api docs). Set to `false` to disable. (`true`)
|
||||
- `threshold` (`Number`): data is compressed only if the byte size is above this value. This option is ignored on the browser. (`1024`)
|
||||
- `extraHeaders` (`Object`): Headers that will be passed for each request to the server (via xhr-polling and via websockets). These values then can be used during handshake or for special proxies. Can only be used in Node.js client environment.
|
||||
- `onlyBinaryUpgrades` (`Boolean`): whether transport upgrades should be restricted to transports supporting binary data (`false`)
|
||||
- `requestTimeout` (`Number`): Timeout for xhr-polling requests in milliseconds (`0`)
|
||||
- `forceNode` (`Boolean`): Uses NodeJS implementation for websockets - even if there is a native Browser-Websocket available, which is preferred by default over the NodeJS implementation. (This is useful when using hybrid platforms like nw.js or electron) (`false`, NodeJS only)
|
||||
- `localAddress` (`String`): the local IP address to connect to
|
||||
- `send`
|
||||
- Sends a message to the server
|
||||
- **Parameters**
|
||||
- `String` | `ArrayBuffer` | `ArrayBufferView` | `Blob`: data to send
|
||||
- `Object`: optional, options object
|
||||
- `Function`: optional, callback upon `drain`
|
||||
- **Options**
|
||||
- `compress` (`Boolean`): whether to compress sending data. This option is ignored and forced to be `true` on the browser. (`true`)
|
||||
- `close`
|
||||
- Disconnects the client.
|
||||
|
||||
### Transport
|
||||
|
||||
The transport class. Private. _Inherits from EventEmitter_.
|
||||
|
||||
#### Events
|
||||
|
||||
- `poll`: emitted by polling transports upon starting a new request
|
||||
- `pollComplete`: emitted by polling transports upon completing a request
|
||||
- `drain`: emitted by polling transports upon a buffer drain
|
||||
|
||||
## Tests
|
||||
|
||||
`engine.io-client` is used to test
|
||||
[engine](http://github.com/socketio/engine.io). Running the `engine.io`
|
||||
test suite ensures the client works and vice-versa.
|
||||
|
||||
Browser tests are run using [zuul](https://github.com/defunctzombie/zuul). You can
|
||||
run the tests locally using the following command.
|
||||
|
||||
```
|
||||
./node_modules/.bin/zuul --local 8080 -- test/index.js
|
||||
```
|
||||
|
||||
Additionally, `engine.io-client` has a standalone test suite you can run
|
||||
with `make test` which will run node.js and browser tests. You must have zuul setup with
|
||||
a saucelabs account.
|
||||
|
||||
## Support
|
||||
|
||||
The support channels for `engine.io-client` are the same as `socket.io`:
|
||||
- irc.freenode.net **#socket.io**
|
||||
- [Google Groups](http://groups.google.com/group/socket_io)
|
||||
- [Website](http://socket.io)
|
||||
|
||||
## Development
|
||||
|
||||
To contribute patches, run tests or benchmarks, make sure to clone the
|
||||
repository:
|
||||
|
||||
```bash
|
||||
git clone git://github.com/socketio/engine.io-client.git
|
||||
```
|
||||
|
||||
Then:
|
||||
|
||||
```bash
|
||||
cd engine.io-client
|
||||
npm install
|
||||
```
|
||||
|
||||
See the `Tests` section above for how to run tests before submitting any patches.
|
||||
|
||||
## License
|
||||
|
||||
MIT - Copyright (c) 2014 Automattic, Inc.
|
4418
node_modules/socket.io-client/node_modules/engine.io-client/engine.io.js
generated
vendored
Normal file
4418
node_modules/socket.io-client/node_modules/engine.io-client/engine.io.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
node_modules/socket.io-client/node_modules/engine.io-client/index.js
generated
vendored
Normal file
2
node_modules/socket.io-client/node_modules/engine.io-client/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
module.exports = require('./lib/index');
|
10
node_modules/socket.io-client/node_modules/engine.io-client/lib/index.js
generated
vendored
Normal file
10
node_modules/socket.io-client/node_modules/engine.io-client/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
module.exports = require('./socket');
|
||||
|
||||
/**
|
||||
* Exports parser
|
||||
*
|
||||
* @api public
|
||||
*
|
||||
*/
|
||||
module.exports.parser = require('engine.io-parser');
|
738
node_modules/socket.io-client/node_modules/engine.io-client/lib/socket.js
generated
vendored
Normal file
738
node_modules/socket.io-client/node_modules/engine.io-client/lib/socket.js
generated
vendored
Normal file
@ -0,0 +1,738 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var transports = require('./transports/index');
|
||||
var Emitter = require('component-emitter');
|
||||
var debug = require('debug')('engine.io-client:socket');
|
||||
var index = require('indexof');
|
||||
var parser = require('engine.io-parser');
|
||||
var parseuri = require('parseuri');
|
||||
var parsejson = require('parsejson');
|
||||
var parseqs = require('parseqs');
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = Socket;
|
||||
|
||||
/**
|
||||
* Socket constructor.
|
||||
*
|
||||
* @param {String|Object} uri or options
|
||||
* @param {Object} options
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Socket (uri, opts) {
|
||||
if (!(this instanceof Socket)) return new Socket(uri, opts);
|
||||
|
||||
opts = opts || {};
|
||||
|
||||
if (uri && 'object' === typeof uri) {
|
||||
opts = uri;
|
||||
uri = null;
|
||||
}
|
||||
|
||||
if (uri) {
|
||||
uri = parseuri(uri);
|
||||
opts.hostname = uri.host;
|
||||
opts.secure = uri.protocol === 'https' || uri.protocol === 'wss';
|
||||
opts.port = uri.port;
|
||||
if (uri.query) opts.query = uri.query;
|
||||
} else if (opts.host) {
|
||||
opts.hostname = parseuri(opts.host).host;
|
||||
}
|
||||
|
||||
this.secure = null != opts.secure ? opts.secure
|
||||
: (global.location && 'https:' === location.protocol);
|
||||
|
||||
if (opts.hostname && !opts.port) {
|
||||
// if no port is specified manually, use the protocol default
|
||||
opts.port = this.secure ? '443' : '80';
|
||||
}
|
||||
|
||||
this.agent = opts.agent || false;
|
||||
this.hostname = opts.hostname ||
|
||||
(global.location ? location.hostname : 'localhost');
|
||||
this.port = opts.port || (global.location && location.port
|
||||
? location.port
|
||||
: (this.secure ? 443 : 80));
|
||||
this.query = opts.query || {};
|
||||
if ('string' === typeof this.query) this.query = parseqs.decode(this.query);
|
||||
this.upgrade = false !== opts.upgrade;
|
||||
this.path = (opts.path || '/engine.io').replace(/\/$/, '') + '/';
|
||||
this.forceJSONP = !!opts.forceJSONP;
|
||||
this.jsonp = false !== opts.jsonp;
|
||||
this.forceBase64 = !!opts.forceBase64;
|
||||
this.enablesXDR = !!opts.enablesXDR;
|
||||
this.timestampParam = opts.timestampParam || 't';
|
||||
this.timestampRequests = opts.timestampRequests;
|
||||
this.transports = opts.transports || ['polling', 'websocket'];
|
||||
this.readyState = '';
|
||||
this.writeBuffer = [];
|
||||
this.prevBufferLen = 0;
|
||||
this.policyPort = opts.policyPort || 843;
|
||||
this.rememberUpgrade = opts.rememberUpgrade || false;
|
||||
this.binaryType = null;
|
||||
this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades;
|
||||
this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || {}) : false;
|
||||
|
||||
if (true === this.perMessageDeflate) this.perMessageDeflate = {};
|
||||
if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) {
|
||||
this.perMessageDeflate.threshold = 1024;
|
||||
}
|
||||
|
||||
// SSL options for Node.js client
|
||||
this.pfx = opts.pfx || null;
|
||||
this.key = opts.key || null;
|
||||
this.passphrase = opts.passphrase || null;
|
||||
this.cert = opts.cert || null;
|
||||
this.ca = opts.ca || null;
|
||||
this.ciphers = opts.ciphers || null;
|
||||
this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? null : opts.rejectUnauthorized;
|
||||
this.forceNode = !!opts.forceNode;
|
||||
|
||||
// other options for Node.js client
|
||||
var freeGlobal = typeof global === 'object' && global;
|
||||
if (freeGlobal.global === freeGlobal) {
|
||||
if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) {
|
||||
this.extraHeaders = opts.extraHeaders;
|
||||
}
|
||||
|
||||
if (opts.localAddress) {
|
||||
this.localAddress = opts.localAddress;
|
||||
}
|
||||
}
|
||||
|
||||
// set on handshake
|
||||
this.id = null;
|
||||
this.upgrades = null;
|
||||
this.pingInterval = null;
|
||||
this.pingTimeout = null;
|
||||
|
||||
// set on heartbeat
|
||||
this.pingIntervalTimer = null;
|
||||
this.pingTimeoutTimer = null;
|
||||
|
||||
this.open();
|
||||
}
|
||||
|
||||
Socket.priorWebsocketSuccess = false;
|
||||
|
||||
/**
|
||||
* Mix in `Emitter`.
|
||||
*/
|
||||
|
||||
Emitter(Socket.prototype);
|
||||
|
||||
/**
|
||||
* Protocol version.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Socket.protocol = parser.protocol; // this is an int
|
||||
|
||||
/**
|
||||
* Expose deps for legacy compatibility
|
||||
* and standalone browser access.
|
||||
*/
|
||||
|
||||
Socket.Socket = Socket;
|
||||
Socket.Transport = require('./transport');
|
||||
Socket.transports = require('./transports/index');
|
||||
Socket.parser = require('engine.io-parser');
|
||||
|
||||
/**
|
||||
* Creates transport of the given type.
|
||||
*
|
||||
* @param {String} transport name
|
||||
* @return {Transport}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.createTransport = function (name) {
|
||||
debug('creating transport "%s"', name);
|
||||
var query = clone(this.query);
|
||||
|
||||
// append engine.io protocol identifier
|
||||
query.EIO = parser.protocol;
|
||||
|
||||
// transport name
|
||||
query.transport = name;
|
||||
|
||||
// session id if we already have one
|
||||
if (this.id) query.sid = this.id;
|
||||
|
||||
var transport = new transports[name]({
|
||||
agent: this.agent,
|
||||
hostname: this.hostname,
|
||||
port: this.port,
|
||||
secure: this.secure,
|
||||
path: this.path,
|
||||
query: query,
|
||||
forceJSONP: this.forceJSONP,
|
||||
jsonp: this.jsonp,
|
||||
forceBase64: this.forceBase64,
|
||||
enablesXDR: this.enablesXDR,
|
||||
timestampRequests: this.timestampRequests,
|
||||
timestampParam: this.timestampParam,
|
||||
policyPort: this.policyPort,
|
||||
socket: this,
|
||||
pfx: this.pfx,
|
||||
key: this.key,
|
||||
passphrase: this.passphrase,
|
||||
cert: this.cert,
|
||||
ca: this.ca,
|
||||
ciphers: this.ciphers,
|
||||
rejectUnauthorized: this.rejectUnauthorized,
|
||||
perMessageDeflate: this.perMessageDeflate,
|
||||
extraHeaders: this.extraHeaders,
|
||||
forceNode: this.forceNode,
|
||||
localAddress: this.localAddress
|
||||
});
|
||||
|
||||
return transport;
|
||||
};
|
||||
|
||||
function clone (obj) {
|
||||
var o = {};
|
||||
for (var i in obj) {
|
||||
if (obj.hasOwnProperty(i)) {
|
||||
o[i] = obj[i];
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes transport to use and starts probe.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
Socket.prototype.open = function () {
|
||||
var transport;
|
||||
if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') !== -1) {
|
||||
transport = 'websocket';
|
||||
} else if (0 === this.transports.length) {
|
||||
// Emit error on next tick so it can be listened to
|
||||
var self = this;
|
||||
setTimeout(function () {
|
||||
self.emit('error', 'No transports available');
|
||||
}, 0);
|
||||
return;
|
||||
} else {
|
||||
transport = this.transports[0];
|
||||
}
|
||||
this.readyState = 'opening';
|
||||
|
||||
// Retry with the next transport if the transport is disabled (jsonp: false)
|
||||
try {
|
||||
transport = this.createTransport(transport);
|
||||
} catch (e) {
|
||||
this.transports.shift();
|
||||
this.open();
|
||||
return;
|
||||
}
|
||||
|
||||
transport.open();
|
||||
this.setTransport(transport);
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the current transport. Disables the existing one (if any).
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.setTransport = function (transport) {
|
||||
debug('setting transport %s', transport.name);
|
||||
var self = this;
|
||||
|
||||
if (this.transport) {
|
||||
debug('clearing existing transport %s', this.transport.name);
|
||||
this.transport.removeAllListeners();
|
||||
}
|
||||
|
||||
// set up transport
|
||||
this.transport = transport;
|
||||
|
||||
// set up transport listeners
|
||||
transport
|
||||
.on('drain', function () {
|
||||
self.onDrain();
|
||||
})
|
||||
.on('packet', function (packet) {
|
||||
self.onPacket(packet);
|
||||
})
|
||||
.on('error', function (e) {
|
||||
self.onError(e);
|
||||
})
|
||||
.on('close', function () {
|
||||
self.onClose('transport close');
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Probes a transport.
|
||||
*
|
||||
* @param {String} transport name
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.probe = function (name) {
|
||||
debug('probing transport "%s"', name);
|
||||
var transport = this.createTransport(name, { probe: 1 });
|
||||
var failed = false;
|
||||
var self = this;
|
||||
|
||||
Socket.priorWebsocketSuccess = false;
|
||||
|
||||
function onTransportOpen () {
|
||||
if (self.onlyBinaryUpgrades) {
|
||||
var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary;
|
||||
failed = failed || upgradeLosesBinary;
|
||||
}
|
||||
if (failed) return;
|
||||
|
||||
debug('probe transport "%s" opened', name);
|
||||
transport.send([{ type: 'ping', data: 'probe' }]);
|
||||
transport.once('packet', function (msg) {
|
||||
if (failed) return;
|
||||
if ('pong' === msg.type && 'probe' === msg.data) {
|
||||
debug('probe transport "%s" pong', name);
|
||||
self.upgrading = true;
|
||||
self.emit('upgrading', transport);
|
||||
if (!transport) return;
|
||||
Socket.priorWebsocketSuccess = 'websocket' === transport.name;
|
||||
|
||||
debug('pausing current transport "%s"', self.transport.name);
|
||||
self.transport.pause(function () {
|
||||
if (failed) return;
|
||||
if ('closed' === self.readyState) return;
|
||||
debug('changing transport and sending upgrade packet');
|
||||
|
||||
cleanup();
|
||||
|
||||
self.setTransport(transport);
|
||||
transport.send([{ type: 'upgrade' }]);
|
||||
self.emit('upgrade', transport);
|
||||
transport = null;
|
||||
self.upgrading = false;
|
||||
self.flush();
|
||||
});
|
||||
} else {
|
||||
debug('probe transport "%s" failed', name);
|
||||
var err = new Error('probe error');
|
||||
err.transport = transport.name;
|
||||
self.emit('upgradeError', err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function freezeTransport () {
|
||||
if (failed) return;
|
||||
|
||||
// Any callback called by transport should be ignored since now
|
||||
failed = true;
|
||||
|
||||
cleanup();
|
||||
|
||||
transport.close();
|
||||
transport = null;
|
||||
}
|
||||
|
||||
// Handle any error that happens while probing
|
||||
function onerror (err) {
|
||||
var error = new Error('probe error: ' + err);
|
||||
error.transport = transport.name;
|
||||
|
||||
freezeTransport();
|
||||
|
||||
debug('probe transport "%s" failed because of error: %s', name, err);
|
||||
|
||||
self.emit('upgradeError', error);
|
||||
}
|
||||
|
||||
function onTransportClose () {
|
||||
onerror('transport closed');
|
||||
}
|
||||
|
||||
// When the socket is closed while we're probing
|
||||
function onclose () {
|
||||
onerror('socket closed');
|
||||
}
|
||||
|
||||
// When the socket is upgraded while we're probing
|
||||
function onupgrade (to) {
|
||||
if (transport && to.name !== transport.name) {
|
||||
debug('"%s" works - aborting "%s"', to.name, transport.name);
|
||||
freezeTransport();
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all listeners on the transport and on self
|
||||
function cleanup () {
|
||||
transport.removeListener('open', onTransportOpen);
|
||||
transport.removeListener('error', onerror);
|
||||
transport.removeListener('close', onTransportClose);
|
||||
self.removeListener('close', onclose);
|
||||
self.removeListener('upgrading', onupgrade);
|
||||
}
|
||||
|
||||
transport.once('open', onTransportOpen);
|
||||
transport.once('error', onerror);
|
||||
transport.once('close', onTransportClose);
|
||||
|
||||
this.once('close', onclose);
|
||||
this.once('upgrading', onupgrade);
|
||||
|
||||
transport.open();
|
||||
};
|
||||
|
||||
/**
|
||||
* Called when connection is deemed open.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Socket.prototype.onOpen = function () {
|
||||
debug('socket open');
|
||||
this.readyState = 'open';
|
||||
Socket.priorWebsocketSuccess = 'websocket' === this.transport.name;
|
||||
this.emit('open');
|
||||
this.flush();
|
||||
|
||||
// we check for `readyState` in case an `open`
|
||||
// listener already closed the socket
|
||||
if ('open' === this.readyState && this.upgrade && this.transport.pause) {
|
||||
debug('starting upgrade probes');
|
||||
for (var i = 0, l = this.upgrades.length; i < l; i++) {
|
||||
this.probe(this.upgrades[i]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Handles a packet.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.onPacket = function (packet) {
|
||||
if ('opening' === this.readyState || 'open' === this.readyState ||
|
||||
'closing' === this.readyState) {
|
||||
debug('socket receive: type "%s", data "%s"', packet.type, packet.data);
|
||||
|
||||
this.emit('packet', packet);
|
||||
|
||||
// Socket is live - any packet counts
|
||||
this.emit('heartbeat');
|
||||
|
||||
switch (packet.type) {
|
||||
case 'open':
|
||||
this.onHandshake(parsejson(packet.data));
|
||||
break;
|
||||
|
||||
case 'pong':
|
||||
this.setPing();
|
||||
this.emit('pong');
|
||||
break;
|
||||
|
||||
case 'error':
|
||||
var err = new Error('server error');
|
||||
err.code = packet.data;
|
||||
this.onError(err);
|
||||
break;
|
||||
|
||||
case 'message':
|
||||
this.emit('data', packet.data);
|
||||
this.emit('message', packet.data);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
debug('packet received with socket readyState "%s"', this.readyState);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon handshake completion.
|
||||
*
|
||||
* @param {Object} handshake obj
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.onHandshake = function (data) {
|
||||
this.emit('handshake', data);
|
||||
this.id = data.sid;
|
||||
this.transport.query.sid = data.sid;
|
||||
this.upgrades = this.filterUpgrades(data.upgrades);
|
||||
this.pingInterval = data.pingInterval;
|
||||
this.pingTimeout = data.pingTimeout;
|
||||
this.onOpen();
|
||||
// In case open handler closes socket
|
||||
if ('closed' === this.readyState) return;
|
||||
this.setPing();
|
||||
|
||||
// Prolong liveness of socket on heartbeat
|
||||
this.removeListener('heartbeat', this.onHeartbeat);
|
||||
this.on('heartbeat', this.onHeartbeat);
|
||||
};
|
||||
|
||||
/**
|
||||
* Resets ping timeout.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.onHeartbeat = function (timeout) {
|
||||
clearTimeout(this.pingTimeoutTimer);
|
||||
var self = this;
|
||||
self.pingTimeoutTimer = setTimeout(function () {
|
||||
if ('closed' === self.readyState) return;
|
||||
self.onClose('ping timeout');
|
||||
}, timeout || (self.pingInterval + self.pingTimeout));
|
||||
};
|
||||
|
||||
/**
|
||||
* Pings server every `this.pingInterval` and expects response
|
||||
* within `this.pingTimeout` or closes connection.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.setPing = function () {
|
||||
var self = this;
|
||||
clearTimeout(self.pingIntervalTimer);
|
||||
self.pingIntervalTimer = setTimeout(function () {
|
||||
debug('writing ping packet - expecting pong within %sms', self.pingTimeout);
|
||||
self.ping();
|
||||
self.onHeartbeat(self.pingTimeout);
|
||||
}, self.pingInterval);
|
||||
};
|
||||
|
||||
/**
|
||||
* Sends a ping packet.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.ping = function () {
|
||||
var self = this;
|
||||
this.sendPacket('ping', function () {
|
||||
self.emit('ping');
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Called on `drain` event
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.onDrain = function () {
|
||||
this.writeBuffer.splice(0, this.prevBufferLen);
|
||||
|
||||
// setting prevBufferLen = 0 is very important
|
||||
// for example, when upgrading, upgrade packet is sent over,
|
||||
// and a nonzero prevBufferLen could cause problems on `drain`
|
||||
this.prevBufferLen = 0;
|
||||
|
||||
if (0 === this.writeBuffer.length) {
|
||||
this.emit('drain');
|
||||
} else {
|
||||
this.flush();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Flush write buffers.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.flush = function () {
|
||||
if ('closed' !== this.readyState && this.transport.writable &&
|
||||
!this.upgrading && this.writeBuffer.length) {
|
||||
debug('flushing %d packets in socket', this.writeBuffer.length);
|
||||
this.transport.send(this.writeBuffer);
|
||||
// keep track of current length of writeBuffer
|
||||
// splice writeBuffer and callbackBuffer on `drain`
|
||||
this.prevBufferLen = this.writeBuffer.length;
|
||||
this.emit('flush');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Sends a message.
|
||||
*
|
||||
* @param {String} message.
|
||||
* @param {Function} callback function.
|
||||
* @param {Object} options.
|
||||
* @return {Socket} for chaining.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Socket.prototype.write =
|
||||
Socket.prototype.send = function (msg, options, fn) {
|
||||
this.sendPacket('message', msg, options, fn);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sends a packet.
|
||||
*
|
||||
* @param {String} packet type.
|
||||
* @param {String} data.
|
||||
* @param {Object} options.
|
||||
* @param {Function} callback function.
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.sendPacket = function (type, data, options, fn) {
|
||||
if ('function' === typeof data) {
|
||||
fn = data;
|
||||
data = undefined;
|
||||
}
|
||||
|
||||
if ('function' === typeof options) {
|
||||
fn = options;
|
||||
options = null;
|
||||
}
|
||||
|
||||
if ('closing' === this.readyState || 'closed' === this.readyState) {
|
||||
return;
|
||||
}
|
||||
|
||||
options = options || {};
|
||||
options.compress = false !== options.compress;
|
||||
|
||||
var packet = {
|
||||
type: type,
|
||||
data: data,
|
||||
options: options
|
||||
};
|
||||
this.emit('packetCreate', packet);
|
||||
this.writeBuffer.push(packet);
|
||||
if (fn) this.once('flush', fn);
|
||||
this.flush();
|
||||
};
|
||||
|
||||
/**
|
||||
* Closes the connection.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.close = function () {
|
||||
if ('opening' === this.readyState || 'open' === this.readyState) {
|
||||
this.readyState = 'closing';
|
||||
|
||||
var self = this;
|
||||
|
||||
if (this.writeBuffer.length) {
|
||||
this.once('drain', function () {
|
||||
if (this.upgrading) {
|
||||
waitForUpgrade();
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
});
|
||||
} else if (this.upgrading) {
|
||||
waitForUpgrade();
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
function close () {
|
||||
self.onClose('forced close');
|
||||
debug('socket closing - telling transport to close');
|
||||
self.transport.close();
|
||||
}
|
||||
|
||||
function cleanupAndClose () {
|
||||
self.removeListener('upgrade', cleanupAndClose);
|
||||
self.removeListener('upgradeError', cleanupAndClose);
|
||||
close();
|
||||
}
|
||||
|
||||
function waitForUpgrade () {
|
||||
// wait for upgrade to finish since we can't send packets while pausing a transport
|
||||
self.once('upgrade', cleanupAndClose);
|
||||
self.once('upgradeError', cleanupAndClose);
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon transport error
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.onError = function (err) {
|
||||
debug('socket error %j', err);
|
||||
Socket.priorWebsocketSuccess = false;
|
||||
this.emit('error', err);
|
||||
this.onClose('transport error', err);
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon transport close.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Socket.prototype.onClose = function (reason, desc) {
|
||||
if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) {
|
||||
debug('socket close with reason: "%s"', reason);
|
||||
var self = this;
|
||||
|
||||
// clear timers
|
||||
clearTimeout(this.pingIntervalTimer);
|
||||
clearTimeout(this.pingTimeoutTimer);
|
||||
|
||||
// stop event from firing again for transport
|
||||
this.transport.removeAllListeners('close');
|
||||
|
||||
// ensure transport won't stay open
|
||||
this.transport.close();
|
||||
|
||||
// ignore further transport communication
|
||||
this.transport.removeAllListeners();
|
||||
|
||||
// set ready state
|
||||
this.readyState = 'closed';
|
||||
|
||||
// clear session id
|
||||
this.id = null;
|
||||
|
||||
// emit close event
|
||||
this.emit('close', reason, desc);
|
||||
|
||||
// clean buffers after, so users can still
|
||||
// grab the buffers on `close` event
|
||||
self.writeBuffer = [];
|
||||
self.prevBufferLen = 0;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Filters upgrades, returning only those matching client transports.
|
||||
*
|
||||
* @param {Array} server upgrades
|
||||
* @api private
|
||||
*
|
||||
*/
|
||||
|
||||
Socket.prototype.filterUpgrades = function (upgrades) {
|
||||
var filteredUpgrades = [];
|
||||
for (var i = 0, j = upgrades.length; i < j; i++) {
|
||||
if (~index(this.transports, upgrades[i])) filteredUpgrades.push(upgrades[i]);
|
||||
}
|
||||
return filteredUpgrades;
|
||||
};
|
157
node_modules/socket.io-client/node_modules/engine.io-client/lib/transport.js
generated
vendored
Normal file
157
node_modules/socket.io-client/node_modules/engine.io-client/lib/transport.js
generated
vendored
Normal file
@ -0,0 +1,157 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var parser = require('engine.io-parser');
|
||||
var Emitter = require('component-emitter');
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = Transport;
|
||||
|
||||
/**
|
||||
* Transport abstract constructor.
|
||||
*
|
||||
* @param {Object} options.
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function Transport (opts) {
|
||||
this.path = opts.path;
|
||||
this.hostname = opts.hostname;
|
||||
this.port = opts.port;
|
||||
this.secure = opts.secure;
|
||||
this.query = opts.query;
|
||||
this.timestampParam = opts.timestampParam;
|
||||
this.timestampRequests = opts.timestampRequests;
|
||||
this.readyState = '';
|
||||
this.agent = opts.agent || false;
|
||||
this.socket = opts.socket;
|
||||
this.enablesXDR = opts.enablesXDR;
|
||||
|
||||
// SSL options for Node.js client
|
||||
this.pfx = opts.pfx;
|
||||
this.key = opts.key;
|
||||
this.passphrase = opts.passphrase;
|
||||
this.cert = opts.cert;
|
||||
this.ca = opts.ca;
|
||||
this.ciphers = opts.ciphers;
|
||||
this.rejectUnauthorized = opts.rejectUnauthorized;
|
||||
this.forceNode = opts.forceNode;
|
||||
|
||||
// other options for Node.js client
|
||||
this.extraHeaders = opts.extraHeaders;
|
||||
this.localAddress = opts.localAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mix in `Emitter`.
|
||||
*/
|
||||
|
||||
Emitter(Transport.prototype);
|
||||
|
||||
/**
|
||||
* Emits an error.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {Transport} for chaining
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Transport.prototype.onError = function (msg, desc) {
|
||||
var err = new Error(msg);
|
||||
err.type = 'TransportError';
|
||||
err.description = desc;
|
||||
this.emit('error', err);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Opens the transport.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Transport.prototype.open = function () {
|
||||
if ('closed' === this.readyState || '' === this.readyState) {
|
||||
this.readyState = 'opening';
|
||||
this.doOpen();
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Closes the transport.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Transport.prototype.close = function () {
|
||||
if ('opening' === this.readyState || 'open' === this.readyState) {
|
||||
this.doClose();
|
||||
this.onClose();
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sends multiple packets.
|
||||
*
|
||||
* @param {Array} packets
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Transport.prototype.send = function (packets) {
|
||||
if ('open' === this.readyState) {
|
||||
this.write(packets);
|
||||
} else {
|
||||
throw new Error('Transport not open');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon open
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Transport.prototype.onOpen = function () {
|
||||
this.readyState = 'open';
|
||||
this.writable = true;
|
||||
this.emit('open');
|
||||
};
|
||||
|
||||
/**
|
||||
* Called with data.
|
||||
*
|
||||
* @param {String} data
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Transport.prototype.onData = function (data) {
|
||||
var packet = parser.decodePacket(data, this.socket.binaryType);
|
||||
this.onPacket(packet);
|
||||
};
|
||||
|
||||
/**
|
||||
* Called with a decoded packet.
|
||||
*/
|
||||
|
||||
Transport.prototype.onPacket = function (packet) {
|
||||
this.emit('packet', packet);
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon close.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Transport.prototype.onClose = function () {
|
||||
this.readyState = 'closed';
|
||||
this.emit('close');
|
||||
};
|
53
node_modules/socket.io-client/node_modules/engine.io-client/lib/transports/index.js
generated
vendored
Normal file
53
node_modules/socket.io-client/node_modules/engine.io-client/lib/transports/index.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
var XMLHttpRequest = require('xmlhttprequest-ssl');
|
||||
var XHR = require('./polling-xhr');
|
||||
var JSONP = require('./polling-jsonp');
|
||||
var websocket = require('./websocket');
|
||||
|
||||
/**
|
||||
* Export transports.
|
||||
*/
|
||||
|
||||
exports.polling = polling;
|
||||
exports.websocket = websocket;
|
||||
|
||||
/**
|
||||
* Polling transport polymorphic constructor.
|
||||
* Decides on xhr vs jsonp based on feature detection.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function polling (opts) {
|
||||
var xhr;
|
||||
var xd = false;
|
||||
var xs = false;
|
||||
var jsonp = false !== opts.jsonp;
|
||||
|
||||
if (global.location) {
|
||||
var isSSL = 'https:' === location.protocol;
|
||||
var port = location.port;
|
||||
|
||||
// some user agents have empty `location.port`
|
||||
if (!port) {
|
||||
port = isSSL ? 443 : 80;
|
||||
}
|
||||
|
||||
xd = opts.hostname !== location.hostname || port !== opts.port;
|
||||
xs = opts.secure !== isSSL;
|
||||
}
|
||||
|
||||
opts.xdomain = xd;
|
||||
opts.xscheme = xs;
|
||||
xhr = new XMLHttpRequest(opts);
|
||||
|
||||
if ('open' in xhr && !opts.forceJSONP) {
|
||||
return new XHR(opts);
|
||||
} else {
|
||||
if (!jsonp) throw new Error('JSONP disabled');
|
||||
return new JSONP(opts);
|
||||
}
|
||||
}
|
231
node_modules/socket.io-client/node_modules/engine.io-client/lib/transports/polling-jsonp.js
generated
vendored
Normal file
231
node_modules/socket.io-client/node_modules/engine.io-client/lib/transports/polling-jsonp.js
generated
vendored
Normal file
@ -0,0 +1,231 @@
|
||||
|
||||
/**
|
||||
* Module requirements.
|
||||
*/
|
||||
|
||||
var Polling = require('./polling');
|
||||
var inherit = require('component-inherit');
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = JSONPPolling;
|
||||
|
||||
/**
|
||||
* Cached regular expressions.
|
||||
*/
|
||||
|
||||
var rNewline = /\n/g;
|
||||
var rEscapedNewline = /\\n/g;
|
||||
|
||||
/**
|
||||
* Global JSONP callbacks.
|
||||
*/
|
||||
|
||||
var callbacks;
|
||||
|
||||
/**
|
||||
* Noop.
|
||||
*/
|
||||
|
||||
function empty () { }
|
||||
|
||||
/**
|
||||
* JSONP Polling constructor.
|
||||
*
|
||||
* @param {Object} opts.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function JSONPPolling (opts) {
|
||||
Polling.call(this, opts);
|
||||
|
||||
this.query = this.query || {};
|
||||
|
||||
// define global callbacks array if not present
|
||||
// we do this here (lazily) to avoid unneeded global pollution
|
||||
if (!callbacks) {
|
||||
// we need to consider multiple engines in the same page
|
||||
if (!global.___eio) global.___eio = [];
|
||||
callbacks = global.___eio;
|
||||
}
|
||||
|
||||
// callback identifier
|
||||
this.index = callbacks.length;
|
||||
|
||||
// add callback to jsonp global
|
||||
var self = this;
|
||||
callbacks.push(function (msg) {
|
||||
self.onData(msg);
|
||||
});
|
||||
|
||||
// append to query string
|
||||
this.query.j = this.index;
|
||||
|
||||
// prevent spurious errors from being emitted when the window is unloaded
|
||||
if (global.document && global.addEventListener) {
|
||||
global.addEventListener('beforeunload', function () {
|
||||
if (self.script) self.script.onerror = empty;
|
||||
}, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherits from Polling.
|
||||
*/
|
||||
|
||||
inherit(JSONPPolling, Polling);
|
||||
|
||||
/*
|
||||
* JSONP only supports binary as base64 encoded strings
|
||||
*/
|
||||
|
||||
JSONPPolling.prototype.supportsBinary = false;
|
||||
|
||||
/**
|
||||
* Closes the socket.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
JSONPPolling.prototype.doClose = function () {
|
||||
if (this.script) {
|
||||
this.script.parentNode.removeChild(this.script);
|
||||
this.script = null;
|
||||
}
|
||||
|
||||
if (this.form) {
|
||||
this.form.parentNode.removeChild(this.form);
|
||||
this.form = null;
|
||||
this.iframe = null;
|
||||
}
|
||||
|
||||
Polling.prototype.doClose.call(this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Starts a poll cycle.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
JSONPPolling.prototype.doPoll = function () {
|
||||
var self = this;
|
||||
var script = document.createElement('script');
|
||||
|
||||
if (this.script) {
|
||||
this.script.parentNode.removeChild(this.script);
|
||||
this.script = null;
|
||||
}
|
||||
|
||||
script.async = true;
|
||||
script.src = this.uri();
|
||||
script.onerror = function (e) {
|
||||
self.onError('jsonp poll error', e);
|
||||
};
|
||||
|
||||
var insertAt = document.getElementsByTagName('script')[0];
|
||||
if (insertAt) {
|
||||
insertAt.parentNode.insertBefore(script, insertAt);
|
||||
} else {
|
||||
(document.head || document.body).appendChild(script);
|
||||
}
|
||||
this.script = script;
|
||||
|
||||
var isUAgecko = 'undefined' !== typeof navigator && /gecko/i.test(navigator.userAgent);
|
||||
|
||||
if (isUAgecko) {
|
||||
setTimeout(function () {
|
||||
var iframe = document.createElement('iframe');
|
||||
document.body.appendChild(iframe);
|
||||
document.body.removeChild(iframe);
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Writes with a hidden iframe.
|
||||
*
|
||||
* @param {String} data to send
|
||||
* @param {Function} called upon flush.
|
||||
* @api private
|
||||
*/
|
||||
|
||||
JSONPPolling.prototype.doWrite = function (data, fn) {
|
||||
var self = this;
|
||||
|
||||
if (!this.form) {
|
||||
var form = document.createElement('form');
|
||||
var area = document.createElement('textarea');
|
||||
var id = this.iframeId = 'eio_iframe_' + this.index;
|
||||
var iframe;
|
||||
|
||||
form.className = 'socketio';
|
||||
form.style.position = 'absolute';
|
||||
form.style.top = '-1000px';
|
||||
form.style.left = '-1000px';
|
||||
form.target = id;
|
||||
form.method = 'POST';
|
||||
form.setAttribute('accept-charset', 'utf-8');
|
||||
area.name = 'd';
|
||||
form.appendChild(area);
|
||||
document.body.appendChild(form);
|
||||
|
||||
this.form = form;
|
||||
this.area = area;
|
||||
}
|
||||
|
||||
this.form.action = this.uri();
|
||||
|
||||
function complete () {
|
||||
initIframe();
|
||||
fn();
|
||||
}
|
||||
|
||||
function initIframe () {
|
||||
if (self.iframe) {
|
||||
try {
|
||||
self.form.removeChild(self.iframe);
|
||||
} catch (e) {
|
||||
self.onError('jsonp polling iframe removal error', e);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// ie6 dynamic iframes with target="" support (thanks Chris Lambacher)
|
||||
var html = '<iframe src="javascript:0" name="' + self.iframeId + '">';
|
||||
iframe = document.createElement(html);
|
||||
} catch (e) {
|
||||
iframe = document.createElement('iframe');
|
||||
iframe.name = self.iframeId;
|
||||
iframe.src = 'javascript:0';
|
||||
}
|
||||
|
||||
iframe.id = self.iframeId;
|
||||
|
||||
self.form.appendChild(iframe);
|
||||
self.iframe = iframe;
|
||||
}
|
||||
|
||||
initIframe();
|
||||
|
||||
// escape \n to prevent it from being converted into \r\n by some UAs
|
||||
// double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side
|
||||
data = data.replace(rEscapedNewline, '\\\n');
|
||||
this.area.value = data.replace(rNewline, '\\n');
|
||||
|
||||
try {
|
||||
this.form.submit();
|
||||
} catch (e) {}
|
||||
|
||||
if (this.iframe.attachEvent) {
|
||||
this.iframe.onreadystatechange = function () {
|
||||
if (self.iframe.readyState === 'complete') {
|
||||
complete();
|
||||
}
|
||||
};
|
||||
} else {
|
||||
this.iframe.onload = complete;
|
||||
}
|
||||
};
|
424
node_modules/socket.io-client/node_modules/engine.io-client/lib/transports/polling-xhr.js
generated
vendored
Normal file
424
node_modules/socket.io-client/node_modules/engine.io-client/lib/transports/polling-xhr.js
generated
vendored
Normal file
@ -0,0 +1,424 @@
|
||||
/**
|
||||
* Module requirements.
|
||||
*/
|
||||
|
||||
var XMLHttpRequest = require('xmlhttprequest-ssl');
|
||||
var Polling = require('./polling');
|
||||
var Emitter = require('component-emitter');
|
||||
var inherit = require('component-inherit');
|
||||
var debug = require('debug')('engine.io-client:polling-xhr');
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = XHR;
|
||||
module.exports.Request = Request;
|
||||
|
||||
/**
|
||||
* Empty function
|
||||
*/
|
||||
|
||||
function empty () {}
|
||||
|
||||
/**
|
||||
* XHR Polling constructor.
|
||||
*
|
||||
* @param {Object} opts
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function XHR (opts) {
|
||||
Polling.call(this, opts);
|
||||
this.requestTimeout = opts.requestTimeout;
|
||||
|
||||
if (global.location) {
|
||||
var isSSL = 'https:' === location.protocol;
|
||||
var port = location.port;
|
||||
|
||||
// some user agents have empty `location.port`
|
||||
if (!port) {
|
||||
port = isSSL ? 443 : 80;
|
||||
}
|
||||
|
||||
this.xd = opts.hostname !== global.location.hostname ||
|
||||
port !== opts.port;
|
||||
this.xs = opts.secure !== isSSL;
|
||||
} else {
|
||||
this.extraHeaders = opts.extraHeaders;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherits from Polling.
|
||||
*/
|
||||
|
||||
inherit(XHR, Polling);
|
||||
|
||||
/**
|
||||
* XHR supports binary
|
||||
*/
|
||||
|
||||
XHR.prototype.supportsBinary = true;
|
||||
|
||||
/**
|
||||
* Creates a request.
|
||||
*
|
||||
* @param {String} method
|
||||
* @api private
|
||||
*/
|
||||
|
||||
XHR.prototype.request = function (opts) {
|
||||
opts = opts || {};
|
||||
opts.uri = this.uri();
|
||||
opts.xd = this.xd;
|
||||
opts.xs = this.xs;
|
||||
opts.agent = this.agent || false;
|
||||
opts.supportsBinary = this.supportsBinary;
|
||||
opts.enablesXDR = this.enablesXDR;
|
||||
|
||||
// SSL options for Node.js client
|
||||
opts.pfx = this.pfx;
|
||||
opts.key = this.key;
|
||||
opts.passphrase = this.passphrase;
|
||||
opts.cert = this.cert;
|
||||
opts.ca = this.ca;
|
||||
opts.ciphers = this.ciphers;
|
||||
opts.rejectUnauthorized = this.rejectUnauthorized;
|
||||
opts.requestTimeout = this.requestTimeout;
|
||||
|
||||
// other options for Node.js client
|
||||
opts.extraHeaders = this.extraHeaders;
|
||||
|
||||
return new Request(opts);
|
||||
};
|
||||
|
||||
/**
|
||||
* Sends data.
|
||||
*
|
||||
* @param {String} data to send.
|
||||
* @param {Function} called upon flush.
|
||||
* @api private
|
||||
*/
|
||||
|
||||
XHR.prototype.doWrite = function (data, fn) {
|
||||
var isBinary = typeof data !== 'string' && data !== undefined;
|
||||
var req = this.request({ method: 'POST', data: data, isBinary: isBinary });
|
||||
var self = this;
|
||||
req.on('success', fn);
|
||||
req.on('error', function (err) {
|
||||
self.onError('xhr post error', err);
|
||||
});
|
||||
this.sendXhr = req;
|
||||
};
|
||||
|
||||
/**
|
||||
* Starts a poll cycle.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
XHR.prototype.doPoll = function () {
|
||||
debug('xhr poll');
|
||||
var req = this.request();
|
||||
var self = this;
|
||||
req.on('data', function (data) {
|
||||
self.onData(data);
|
||||
});
|
||||
req.on('error', function (err) {
|
||||
self.onError('xhr poll error', err);
|
||||
});
|
||||
this.pollXhr = req;
|
||||
};
|
||||
|
||||
/**
|
||||
* Request constructor
|
||||
*
|
||||
* @param {Object} options
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Request (opts) {
|
||||
this.method = opts.method || 'GET';
|
||||
this.uri = opts.uri;
|
||||
this.xd = !!opts.xd;
|
||||
this.xs = !!opts.xs;
|
||||
this.async = false !== opts.async;
|
||||
this.data = undefined !== opts.data ? opts.data : null;
|
||||
this.agent = opts.agent;
|
||||
this.isBinary = opts.isBinary;
|
||||
this.supportsBinary = opts.supportsBinary;
|
||||
this.enablesXDR = opts.enablesXDR;
|
||||
this.requestTimeout = opts.requestTimeout;
|
||||
|
||||
// SSL options for Node.js client
|
||||
this.pfx = opts.pfx;
|
||||
this.key = opts.key;
|
||||
this.passphrase = opts.passphrase;
|
||||
this.cert = opts.cert;
|
||||
this.ca = opts.ca;
|
||||
this.ciphers = opts.ciphers;
|
||||
this.rejectUnauthorized = opts.rejectUnauthorized;
|
||||
|
||||
// other options for Node.js client
|
||||
this.extraHeaders = opts.extraHeaders;
|
||||
|
||||
this.create();
|
||||
}
|
||||
|
||||
/**
|
||||
* Mix in `Emitter`.
|
||||
*/
|
||||
|
||||
Emitter(Request.prototype);
|
||||
|
||||
/**
|
||||
* Creates the XHR object and sends the request.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Request.prototype.create = function () {
|
||||
var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR };
|
||||
|
||||
// SSL options for Node.js client
|
||||
opts.pfx = this.pfx;
|
||||
opts.key = this.key;
|
||||
opts.passphrase = this.passphrase;
|
||||
opts.cert = this.cert;
|
||||
opts.ca = this.ca;
|
||||
opts.ciphers = this.ciphers;
|
||||
opts.rejectUnauthorized = this.rejectUnauthorized;
|
||||
|
||||
var xhr = this.xhr = new XMLHttpRequest(opts);
|
||||
var self = this;
|
||||
|
||||
try {
|
||||
debug('xhr open %s: %s', this.method, this.uri);
|
||||
xhr.open(this.method, this.uri, this.async);
|
||||
try {
|
||||
if (this.extraHeaders) {
|
||||
xhr.setDisableHeaderCheck(true);
|
||||
for (var i in this.extraHeaders) {
|
||||
if (this.extraHeaders.hasOwnProperty(i)) {
|
||||
xhr.setRequestHeader(i, this.extraHeaders[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
if (this.supportsBinary) {
|
||||
// This has to be done after open because Firefox is stupid
|
||||
// http://stackoverflow.com/questions/13216903/get-binary-data-with-xmlhttprequest-in-a-firefox-extension
|
||||
xhr.responseType = 'arraybuffer';
|
||||
}
|
||||
|
||||
if ('POST' === this.method) {
|
||||
try {
|
||||
if (this.isBinary) {
|
||||
xhr.setRequestHeader('Content-type', 'application/octet-stream');
|
||||
} else {
|
||||
xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8');
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
try {
|
||||
xhr.setRequestHeader('Accept', '*/*');
|
||||
} catch (e) {}
|
||||
|
||||
// ie6 check
|
||||
if ('withCredentials' in xhr) {
|
||||
xhr.withCredentials = true;
|
||||
}
|
||||
|
||||
if (this.requestTimeout) {
|
||||
xhr.timeout = this.requestTimeout;
|
||||
}
|
||||
|
||||
if (this.hasXDR()) {
|
||||
xhr.onload = function () {
|
||||
self.onLoad();
|
||||
};
|
||||
xhr.onerror = function () {
|
||||
self.onError(xhr.responseText);
|
||||
};
|
||||
} else {
|
||||
xhr.onreadystatechange = function () {
|
||||
if (4 !== xhr.readyState) return;
|
||||
if (200 === xhr.status || 1223 === xhr.status) {
|
||||
self.onLoad();
|
||||
} else {
|
||||
// make sure the `error` event handler that's user-set
|
||||
// does not throw in the same tick and gets caught here
|
||||
setTimeout(function () {
|
||||
self.onError(xhr.status);
|
||||
}, 0);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
debug('xhr data %s', this.data);
|
||||
xhr.send(this.data);
|
||||
} catch (e) {
|
||||
// Need to defer since .create() is called directly fhrom the constructor
|
||||
// and thus the 'error' event can only be only bound *after* this exception
|
||||
// occurs. Therefore, also, we cannot throw here at all.
|
||||
setTimeout(function () {
|
||||
self.onError(e);
|
||||
}, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (global.document) {
|
||||
this.index = Request.requestsCount++;
|
||||
Request.requests[this.index] = this;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon successful response.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Request.prototype.onSuccess = function () {
|
||||
this.emit('success');
|
||||
this.cleanup();
|
||||
};
|
||||
|
||||
/**
|
||||
* Called if we have data.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Request.prototype.onData = function (data) {
|
||||
this.emit('data', data);
|
||||
this.onSuccess();
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon error.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Request.prototype.onError = function (err) {
|
||||
this.emit('error', err);
|
||||
this.cleanup(true);
|
||||
};
|
||||
|
||||
/**
|
||||
* Cleans up house.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Request.prototype.cleanup = function (fromError) {
|
||||
if ('undefined' === typeof this.xhr || null === this.xhr) {
|
||||
return;
|
||||
}
|
||||
// xmlhttprequest
|
||||
if (this.hasXDR()) {
|
||||
this.xhr.onload = this.xhr.onerror = empty;
|
||||
} else {
|
||||
this.xhr.onreadystatechange = empty;
|
||||
}
|
||||
|
||||
if (fromError) {
|
||||
try {
|
||||
this.xhr.abort();
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
if (global.document) {
|
||||
delete Request.requests[this.index];
|
||||
}
|
||||
|
||||
this.xhr = null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon load.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Request.prototype.onLoad = function () {
|
||||
var data;
|
||||
try {
|
||||
var contentType;
|
||||
try {
|
||||
contentType = this.xhr.getResponseHeader('Content-Type').split(';')[0];
|
||||
} catch (e) {}
|
||||
if (contentType === 'application/octet-stream') {
|
||||
data = this.xhr.response || this.xhr.responseText;
|
||||
} else {
|
||||
if (!this.supportsBinary) {
|
||||
data = this.xhr.responseText;
|
||||
} else {
|
||||
try {
|
||||
data = String.fromCharCode.apply(null, new Uint8Array(this.xhr.response));
|
||||
} catch (e) {
|
||||
var ui8Arr = new Uint8Array(this.xhr.response);
|
||||
var dataArray = [];
|
||||
for (var idx = 0, length = ui8Arr.length; idx < length; idx++) {
|
||||
dataArray.push(ui8Arr[idx]);
|
||||
}
|
||||
|
||||
data = String.fromCharCode.apply(null, dataArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
this.onError(e);
|
||||
}
|
||||
if (null != data) {
|
||||
this.onData(data);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if it has XDomainRequest.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Request.prototype.hasXDR = function () {
|
||||
return 'undefined' !== typeof global.XDomainRequest && !this.xs && this.enablesXDR;
|
||||
};
|
||||
|
||||
/**
|
||||
* Aborts the request.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Request.prototype.abort = function () {
|
||||
this.cleanup();
|
||||
};
|
||||
|
||||
/**
|
||||
* Aborts pending requests when unloading the window. This is needed to prevent
|
||||
* memory leaks (e.g. when using IE) and to ensure that no spurious error is
|
||||
* emitted.
|
||||
*/
|
||||
|
||||
Request.requestsCount = 0;
|
||||
Request.requests = {};
|
||||
|
||||
if (global.document) {
|
||||
if (global.attachEvent) {
|
||||
global.attachEvent('onunload', unloadHandler);
|
||||
} else if (global.addEventListener) {
|
||||
global.addEventListener('beforeunload', unloadHandler, false);
|
||||
}
|
||||
}
|
||||
|
||||
function unloadHandler () {
|
||||
for (var i in Request.requests) {
|
||||
if (Request.requests.hasOwnProperty(i)) {
|
||||
Request.requests[i].abort();
|
||||
}
|
||||
}
|
||||
}
|
245
node_modules/socket.io-client/node_modules/engine.io-client/lib/transports/polling.js
generated
vendored
Normal file
245
node_modules/socket.io-client/node_modules/engine.io-client/lib/transports/polling.js
generated
vendored
Normal file
@ -0,0 +1,245 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Transport = require('../transport');
|
||||
var parseqs = require('parseqs');
|
||||
var parser = require('engine.io-parser');
|
||||
var inherit = require('component-inherit');
|
||||
var yeast = require('yeast');
|
||||
var debug = require('debug')('engine.io-client:polling');
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = Polling;
|
||||
|
||||
/**
|
||||
* Is XHR2 supported?
|
||||
*/
|
||||
|
||||
var hasXHR2 = (function () {
|
||||
var XMLHttpRequest = require('xmlhttprequest-ssl');
|
||||
var xhr = new XMLHttpRequest({ xdomain: false });
|
||||
return null != xhr.responseType;
|
||||
})();
|
||||
|
||||
/**
|
||||
* Polling interface.
|
||||
*
|
||||
* @param {Object} opts
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function Polling (opts) {
|
||||
var forceBase64 = (opts && opts.forceBase64);
|
||||
if (!hasXHR2 || forceBase64) {
|
||||
this.supportsBinary = false;
|
||||
}
|
||||
Transport.call(this, opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherits from Transport.
|
||||
*/
|
||||
|
||||
inherit(Polling, Transport);
|
||||
|
||||
/**
|
||||
* Transport name.
|
||||
*/
|
||||
|
||||
Polling.prototype.name = 'polling';
|
||||
|
||||
/**
|
||||
* Opens the socket (triggers polling). We write a PING message to determine
|
||||
* when the transport is open.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Polling.prototype.doOpen = function () {
|
||||
this.poll();
|
||||
};
|
||||
|
||||
/**
|
||||
* Pauses polling.
|
||||
*
|
||||
* @param {Function} callback upon buffers are flushed and transport is paused
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Polling.prototype.pause = function (onPause) {
|
||||
var self = this;
|
||||
|
||||
this.readyState = 'pausing';
|
||||
|
||||
function pause () {
|
||||
debug('paused');
|
||||
self.readyState = 'paused';
|
||||
onPause();
|
||||
}
|
||||
|
||||
if (this.polling || !this.writable) {
|
||||
var total = 0;
|
||||
|
||||
if (this.polling) {
|
||||
debug('we are currently polling - waiting to pause');
|
||||
total++;
|
||||
this.once('pollComplete', function () {
|
||||
debug('pre-pause polling complete');
|
||||
--total || pause();
|
||||
});
|
||||
}
|
||||
|
||||
if (!this.writable) {
|
||||
debug('we are currently writing - waiting to pause');
|
||||
total++;
|
||||
this.once('drain', function () {
|
||||
debug('pre-pause writing complete');
|
||||
--total || pause();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
pause();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Starts polling cycle.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Polling.prototype.poll = function () {
|
||||
debug('polling');
|
||||
this.polling = true;
|
||||
this.doPoll();
|
||||
this.emit('poll');
|
||||
};
|
||||
|
||||
/**
|
||||
* Overloads onData to detect payloads.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Polling.prototype.onData = function (data) {
|
||||
var self = this;
|
||||
debug('polling got data %s', data);
|
||||
var callback = function (packet, index, total) {
|
||||
// if its the first message we consider the transport open
|
||||
if ('opening' === self.readyState) {
|
||||
self.onOpen();
|
||||
}
|
||||
|
||||
// if its a close packet, we close the ongoing requests
|
||||
if ('close' === packet.type) {
|
||||
self.onClose();
|
||||
return false;
|
||||
}
|
||||
|
||||
// otherwise bypass onData and handle the message
|
||||
self.onPacket(packet);
|
||||
};
|
||||
|
||||
// decode payload
|
||||
parser.decodePayload(data, this.socket.binaryType, callback);
|
||||
|
||||
// if an event did not trigger closing
|
||||
if ('closed' !== this.readyState) {
|
||||
// if we got data we're not polling
|
||||
this.polling = false;
|
||||
this.emit('pollComplete');
|
||||
|
||||
if ('open' === this.readyState) {
|
||||
this.poll();
|
||||
} else {
|
||||
debug('ignoring poll - transport state "%s"', this.readyState);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* For polling, send a close packet.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Polling.prototype.doClose = function () {
|
||||
var self = this;
|
||||
|
||||
function close () {
|
||||
debug('writing close packet');
|
||||
self.write([{ type: 'close' }]);
|
||||
}
|
||||
|
||||
if ('open' === this.readyState) {
|
||||
debug('transport open - closing');
|
||||
close();
|
||||
} else {
|
||||
// in case we're trying to close while
|
||||
// handshaking is in progress (GH-164)
|
||||
debug('transport not open - deferring close');
|
||||
this.once('open', close);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Writes a packets payload.
|
||||
*
|
||||
* @param {Array} data packets
|
||||
* @param {Function} drain callback
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Polling.prototype.write = function (packets) {
|
||||
var self = this;
|
||||
this.writable = false;
|
||||
var callbackfn = function () {
|
||||
self.writable = true;
|
||||
self.emit('drain');
|
||||
};
|
||||
|
||||
parser.encodePayload(packets, this.supportsBinary, function (data) {
|
||||
self.doWrite(data, callbackfn);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Generates uri for connection.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Polling.prototype.uri = function () {
|
||||
var query = this.query || {};
|
||||
var schema = this.secure ? 'https' : 'http';
|
||||
var port = '';
|
||||
|
||||
// cache busting is forced
|
||||
if (false !== this.timestampRequests) {
|
||||
query[this.timestampParam] = yeast();
|
||||
}
|
||||
|
||||
if (!this.supportsBinary && !query.sid) {
|
||||
query.b64 = 1;
|
||||
}
|
||||
|
||||
query = parseqs.encode(query);
|
||||
|
||||
// avoid port if default for schema
|
||||
if (this.port && (('https' === schema && Number(this.port) !== 443) ||
|
||||
('http' === schema && Number(this.port) !== 80))) {
|
||||
port = ':' + this.port;
|
||||
}
|
||||
|
||||
// prepend ? to query
|
||||
if (query.length) {
|
||||
query = '?' + query;
|
||||
}
|
||||
|
||||
var ipv6 = this.hostname.indexOf(':') !== -1;
|
||||
return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;
|
||||
};
|
285
node_modules/socket.io-client/node_modules/engine.io-client/lib/transports/websocket.js
generated
vendored
Normal file
285
node_modules/socket.io-client/node_modules/engine.io-client/lib/transports/websocket.js
generated
vendored
Normal file
@ -0,0 +1,285 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Transport = require('../transport');
|
||||
var parser = require('engine.io-parser');
|
||||
var parseqs = require('parseqs');
|
||||
var inherit = require('component-inherit');
|
||||
var yeast = require('yeast');
|
||||
var debug = require('debug')('engine.io-client:websocket');
|
||||
var BrowserWebSocket = global.WebSocket || global.MozWebSocket;
|
||||
var NodeWebSocket;
|
||||
if (typeof window === 'undefined') {
|
||||
try {
|
||||
NodeWebSocket = require('ws');
|
||||
} catch (e) { }
|
||||
}
|
||||
|
||||
/**
|
||||
* Get either the `WebSocket` or `MozWebSocket` globals
|
||||
* in the browser or try to resolve WebSocket-compatible
|
||||
* interface exposed by `ws` for Node-like environment.
|
||||
*/
|
||||
|
||||
var WebSocket = BrowserWebSocket;
|
||||
if (!WebSocket && typeof window === 'undefined') {
|
||||
WebSocket = NodeWebSocket;
|
||||
}
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = WS;
|
||||
|
||||
/**
|
||||
* WebSocket transport constructor.
|
||||
*
|
||||
* @api {Object} connection options
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function WS (opts) {
|
||||
var forceBase64 = (opts && opts.forceBase64);
|
||||
if (forceBase64) {
|
||||
this.supportsBinary = false;
|
||||
}
|
||||
this.perMessageDeflate = opts.perMessageDeflate;
|
||||
this.usingBrowserWebSocket = BrowserWebSocket && !opts.forceNode;
|
||||
if (!this.usingBrowserWebSocket) {
|
||||
WebSocket = NodeWebSocket;
|
||||
}
|
||||
Transport.call(this, opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherits from Transport.
|
||||
*/
|
||||
|
||||
inherit(WS, Transport);
|
||||
|
||||
/**
|
||||
* Transport name.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
WS.prototype.name = 'websocket';
|
||||
|
||||
/*
|
||||
* WebSockets support binary
|
||||
*/
|
||||
|
||||
WS.prototype.supportsBinary = true;
|
||||
|
||||
/**
|
||||
* Opens socket.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
WS.prototype.doOpen = function () {
|
||||
if (!this.check()) {
|
||||
// let probe timeout
|
||||
return;
|
||||
}
|
||||
|
||||
var uri = this.uri();
|
||||
var protocols = void (0);
|
||||
var opts = {
|
||||
agent: this.agent,
|
||||
perMessageDeflate: this.perMessageDeflate
|
||||
};
|
||||
|
||||
// SSL options for Node.js client
|
||||
opts.pfx = this.pfx;
|
||||
opts.key = this.key;
|
||||
opts.passphrase = this.passphrase;
|
||||
opts.cert = this.cert;
|
||||
opts.ca = this.ca;
|
||||
opts.ciphers = this.ciphers;
|
||||
opts.rejectUnauthorized = this.rejectUnauthorized;
|
||||
if (this.extraHeaders) {
|
||||
opts.headers = this.extraHeaders;
|
||||
}
|
||||
if (this.localAddress) {
|
||||
opts.localAddress = this.localAddress;
|
||||
}
|
||||
|
||||
try {
|
||||
this.ws = this.usingBrowserWebSocket ? new WebSocket(uri) : new WebSocket(uri, protocols, opts);
|
||||
} catch (err) {
|
||||
return this.emit('error', err);
|
||||
}
|
||||
|
||||
if (this.ws.binaryType === undefined) {
|
||||
this.supportsBinary = false;
|
||||
}
|
||||
|
||||
if (this.ws.supports && this.ws.supports.binary) {
|
||||
this.supportsBinary = true;
|
||||
this.ws.binaryType = 'nodebuffer';
|
||||
} else {
|
||||
this.ws.binaryType = 'arraybuffer';
|
||||
}
|
||||
|
||||
this.addEventListeners();
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds event listeners to the socket
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
WS.prototype.addEventListeners = function () {
|
||||
var self = this;
|
||||
|
||||
this.ws.onopen = function () {
|
||||
self.onOpen();
|
||||
};
|
||||
this.ws.onclose = function () {
|
||||
self.onClose();
|
||||
};
|
||||
this.ws.onmessage = function (ev) {
|
||||
self.onData(ev.data);
|
||||
};
|
||||
this.ws.onerror = function (e) {
|
||||
self.onError('websocket error', e);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Writes data to socket.
|
||||
*
|
||||
* @param {Array} array of packets.
|
||||
* @api private
|
||||
*/
|
||||
|
||||
WS.prototype.write = function (packets) {
|
||||
var self = this;
|
||||
this.writable = false;
|
||||
|
||||
// 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 (!self.usingBrowserWebSocket) {
|
||||
// always create a new object (GH-437)
|
||||
var opts = {};
|
||||
if (packet.options) {
|
||||
opts.compress = packet.options.compress;
|
||||
}
|
||||
|
||||
if (self.perMessageDeflate) {
|
||||
var len = 'string' === typeof data ? global.Buffer.byteLength(data) : data.length;
|
||||
if (len < self.perMessageDeflate.threshold) {
|
||||
opts.compress = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sometimes the websocket has already been closed but the browser didn't
|
||||
// have a chance of informing us about it yet, in that case send will
|
||||
// throw an error
|
||||
try {
|
||||
if (self.usingBrowserWebSocket) {
|
||||
// TypeError is thrown when passing the second argument on Safari
|
||||
self.ws.send(data);
|
||||
} else {
|
||||
self.ws.send(data, opts);
|
||||
}
|
||||
} catch (e) {
|
||||
debug('websocket closed before onclose event');
|
||||
}
|
||||
|
||||
--total || done();
|
||||
});
|
||||
})(packets[i]);
|
||||
}
|
||||
|
||||
function done () {
|
||||
self.emit('flush');
|
||||
|
||||
// fake drain
|
||||
// defer to next tick to allow Socket to clear writeBuffer
|
||||
setTimeout(function () {
|
||||
self.writable = true;
|
||||
self.emit('drain');
|
||||
}, 0);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Called upon close
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
WS.prototype.onClose = function () {
|
||||
Transport.prototype.onClose.call(this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Closes socket.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
WS.prototype.doClose = function () {
|
||||
if (typeof this.ws !== 'undefined') {
|
||||
this.ws.close();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Generates uri for connection.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
WS.prototype.uri = function () {
|
||||
var query = this.query || {};
|
||||
var schema = this.secure ? 'wss' : 'ws';
|
||||
var port = '';
|
||||
|
||||
// avoid port if default for schema
|
||||
if (this.port && (('wss' === schema && Number(this.port) !== 443) ||
|
||||
('ws' === schema && Number(this.port) !== 80))) {
|
||||
port = ':' + this.port;
|
||||
}
|
||||
|
||||
// append timestamp to URI
|
||||
if (this.timestampRequests) {
|
||||
query[this.timestampParam] = yeast();
|
||||
}
|
||||
|
||||
// communicate binary support capabilities
|
||||
if (!this.supportsBinary) {
|
||||
query.b64 = 1;
|
||||
}
|
||||
|
||||
query = parseqs.encode(query);
|
||||
|
||||
// prepend ? to query
|
||||
if (query.length) {
|
||||
query = '?' + query;
|
||||
}
|
||||
|
||||
var ipv6 = this.hostname.indexOf(':') !== -1;
|
||||
return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;
|
||||
};
|
||||
|
||||
/**
|
||||
* Feature detection for WebSocket.
|
||||
*
|
||||
* @return {Boolean} whether this transport is available.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
WS.prototype.check = function () {
|
||||
return !!WebSocket && !('__initialize' in WebSocket && this.name === WS.prototype.name);
|
||||
};
|
37
node_modules/socket.io-client/node_modules/engine.io-client/lib/xmlhttprequest.js
generated
vendored
Normal file
37
node_modules/socket.io-client/node_modules/engine.io-client/lib/xmlhttprequest.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
// browser shim for xmlhttprequest module
|
||||
|
||||
var hasCORS = require('has-cors');
|
||||
|
||||
module.exports = function (opts) {
|
||||
var xdomain = opts.xdomain;
|
||||
|
||||
// scheme must be same when usign XDomainRequest
|
||||
// http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx
|
||||
var xscheme = opts.xscheme;
|
||||
|
||||
// XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default.
|
||||
// https://github.com/Automattic/engine.io-client/pull/217
|
||||
var enablesXDR = opts.enablesXDR;
|
||||
|
||||
// XMLHttpRequest can be disabled on IE
|
||||
try {
|
||||
if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) {
|
||||
return new XMLHttpRequest();
|
||||
}
|
||||
} catch (e) { }
|
||||
|
||||
// Use XDomainRequest for IE8 if enablesXDR is true
|
||||
// because loading bar keeps flashing when using jsonp-polling
|
||||
// https://github.com/yujiosaka/socke.io-ie8-loading-example
|
||||
try {
|
||||
if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) {
|
||||
return new XDomainRequest();
|
||||
}
|
||||
} catch (e) { }
|
||||
|
||||
if (!xdomain) {
|
||||
try {
|
||||
return new global[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP');
|
||||
} catch (e) { }
|
||||
}
|
||||
};
|
150
node_modules/socket.io-client/node_modules/engine.io-client/package.json
generated
vendored
Normal file
150
node_modules/socket.io-client/node_modules/engine.io-client/package.json
generated
vendored
Normal file
@ -0,0 +1,150 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "engine.io-client@1.8.0",
|
||||
"scope": null,
|
||||
"escapedName": "engine.io-client",
|
||||
"name": "engine.io-client",
|
||||
"rawSpec": "1.8.0",
|
||||
"spec": "1.8.0",
|
||||
"type": "version"
|
||||
},
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\socket.io-client"
|
||||
]
|
||||
],
|
||||
"_from": "engine.io-client@1.8.0",
|
||||
"_id": "engine.io-client@1.8.0",
|
||||
"_inCache": true,
|
||||
"_location": "/socket.io-client/engine.io-client",
|
||||
"_nodeVersion": "4.4.7",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/engine.io-client-1.8.0.tgz_1479608866356_0.14154032664373517"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "darrachequesne",
|
||||
"email": "damien.arrachequesne@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.15.8",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "engine.io-client@1.8.0",
|
||||
"scope": null,
|
||||
"escapedName": "engine.io-client",
|
||||
"name": "engine.io-client",
|
||||
"rawSpec": "1.8.0",
|
||||
"spec": "1.8.0",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/socket.io-client"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-1.8.0.tgz",
|
||||
"_shasum": "7b730e4127414087596d9be3c88d2bc5fdb6cf5c",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "engine.io-client@1.8.0",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\socket.io-client",
|
||||
"browser": {
|
||||
"ws": false,
|
||||
"xmlhttprequest-ssl": "./lib/xmlhttprequest.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/socketio/engine.io-client/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Guillermo Rauch",
|
||||
"email": "rauchg@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Vladimir Dronnikov",
|
||||
"email": "dronnikov@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Christoph Dorn",
|
||||
"url": "https://github.com/cadorn"
|
||||
},
|
||||
{
|
||||
"name": "Mark Mokryn",
|
||||
"email": "mokesmokes@gmail.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"component-emitter": "1.2.1",
|
||||
"component-inherit": "0.0.3",
|
||||
"debug": "2.3.3",
|
||||
"engine.io-parser": "1.3.1",
|
||||
"has-cors": "1.1.0",
|
||||
"indexof": "0.0.1",
|
||||
"parsejson": "0.0.3",
|
||||
"parseqs": "0.0.5",
|
||||
"parseuri": "0.0.5",
|
||||
"ws": "1.1.1",
|
||||
"xmlhttprequest-ssl": "1.5.3",
|
||||
"yeast": "0.1.2"
|
||||
},
|
||||
"description": "Client for the realtime Engine",
|
||||
"devDependencies": {
|
||||
"babel-core": "6.4.5",
|
||||
"babel-eslint": "4.1.7",
|
||||
"babel-loader": "6.2.1",
|
||||
"babel-preset-es2015": "6.3.13",
|
||||
"blob": "0.0.4",
|
||||
"concat-stream": "1.4.6",
|
||||
"del": "2.2.0",
|
||||
"derequire": "1.2.0",
|
||||
"engine.io": "1.8.0",
|
||||
"eslint-config-standard": "4.4.0",
|
||||
"eslint-plugin-standard": "1.3.1",
|
||||
"expect.js": "0.2.0",
|
||||
"express": "3.4.8",
|
||||
"gulp": "3.9.0",
|
||||
"gulp-eslint": "1.1.1",
|
||||
"gulp-file": "0.2.0",
|
||||
"gulp-istanbul": "0.10.3",
|
||||
"gulp-mocha": "2.2.0",
|
||||
"gulp-task-listing": "1.0.1",
|
||||
"istanbul": "0.2.3",
|
||||
"mocha": "1.16.2",
|
||||
"webpack": "1.12.12",
|
||||
"webpack-stream": "3.1.0",
|
||||
"zuul": "3.11.0",
|
||||
"zuul-builder-webpack": "1.1.0",
|
||||
"zuul-ngrok": "4.0.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "7b730e4127414087596d9be3c88d2bc5fdb6cf5c",
|
||||
"tarball": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-1.8.0.tgz"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"lib/",
|
||||
"engine.io.js"
|
||||
],
|
||||
"gitHead": "6d7d66401b0a7968d89c2998fbc98586184d6cc3",
|
||||
"homepage": "https://github.com/socketio/engine.io-client",
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "darrachequesne",
|
||||
"email": "damien.arrachequesne@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "rauchg",
|
||||
"email": "rauchg@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "engine.io-client",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/socketio/engine.io-client.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "gulp test"
|
||||
},
|
||||
"version": "1.8.0"
|
||||
}
|
136
node_modules/socket.io-client/node_modules/engine.io-parser/History.md
generated
vendored
Normal file
136
node_modules/socket.io-client/node_modules/engine.io-parser/History.md
generated
vendored
Normal file
@ -0,0 +1,136 @@
|
||||
|
||||
1.3.1 / 2016-10-20
|
||||
==================
|
||||
|
||||
* [fix] Add safety check for global object (#71)
|
||||
* [fix] decodePacket now accepts both Buffer and ArrayBuffer as data (#64)
|
||||
* [fix] Handle undefined case properly when decoding packet (#74)
|
||||
* [chore] Bump zuul to 3.11.0 & zuul-ngrok to 4.0.0 (#70)
|
||||
* [chore] Update zuul browser settings (#73)
|
||||
|
||||
1.3.0 / 2016-09-26
|
||||
==================
|
||||
|
||||
* [fix] Fix crashes in React Native "navigator is not defined" (#55)
|
||||
* [refactor] Require base64-arraybuffer module conditionally. (#58)
|
||||
* [perf] Split try catch into separate function (#65)
|
||||
* [chore] Use wtf-8 instead of utf8 to prevent lone surrogates from generating parsing error (#68)
|
||||
* [chore] Restrict files included in npm package (#67)
|
||||
* [chore] Update license and repository url (#66)
|
||||
* [chore] Update zuul browser settings following EOL notices (#62)
|
||||
* [chore] bump zuul (#56)
|
||||
|
||||
1.2.4 / 2015-12-04
|
||||
==================
|
||||
|
||||
* fix `ArrayBuffer` encoding in base64 string
|
||||
|
||||
1.2.3 / 2015-11-28
|
||||
==================
|
||||
|
||||
* fix encoding blob as base64
|
||||
|
||||
1.2.2 / 2015-09-09
|
||||
==================
|
||||
|
||||
* fixes for iojs/node
|
||||
|
||||
1.2.1 / 2015-01-17
|
||||
==================
|
||||
|
||||
* pass has-binary result to encodePacket [rase-]
|
||||
* Fix parse error [rase-]
|
||||
|
||||
1.2.0 / 2015-01-11
|
||||
==================
|
||||
|
||||
* fix return type for decodePacket
|
||||
* README fixes
|
||||
* use travis matrix for better test runs
|
||||
* encode into binary only if needed
|
||||
* add test cases for base64 object encoding.
|
||||
* add encodeBase64Object to encoder for browser
|
||||
* avoid sending Blobs on PhantomJS (as on Android)
|
||||
* test that utf8 encoding is not on by default but can be switched on manually
|
||||
|
||||
1.1.0 / 2014-07-16
|
||||
==================
|
||||
|
||||
* make utf8 encoding/decoding optional
|
||||
|
||||
1.0.8 / 2014-07-16
|
||||
==================
|
||||
|
||||
* adjust protocol revision
|
||||
* handle invalid utf8 errors gracefully
|
||||
* fix memory leak on browser
|
||||
|
||||
1.0.7 / 2014-06-24
|
||||
==================
|
||||
|
||||
* fix decodePayloadAsBinary memory leak [christophwitzko]
|
||||
* README improvements
|
||||
|
||||
1.0.6 / 2014-05-30
|
||||
==================
|
||||
|
||||
* utf8 fixes when using binary encoding [nkzawa]
|
||||
|
||||
1.0.5 / 2014-05-06
|
||||
==================
|
||||
|
||||
* fix range error
|
||||
|
||||
1.0.4 / 2014-04-13
|
||||
==================
|
||||
|
||||
* fix `encodePayloadAsBinary` method encodes packets to base64
|
||||
|
||||
1.0.3 / 2014-04-10
|
||||
==================
|
||||
|
||||
* Fix length calculation when encoding as binary [binlain]
|
||||
|
||||
1.0.2 / 2014-03-16
|
||||
==================
|
||||
|
||||
* fix binary for android due to a bug in Blob XHR2 implementation [Rase-]
|
||||
|
||||
1.0.1 / 2014-03-06
|
||||
==================
|
||||
|
||||
* implement `blob` module to simplify code
|
||||
* bump `arraybuffer.slice`
|
||||
* style fixes
|
||||
|
||||
1.0.0 / 2014-02-18
|
||||
==================
|
||||
|
||||
* parser: added binary encoding [Rase-]
|
||||
* parser: switched to an async interface [Rase-]
|
||||
|
||||
0.3.0 / 2013-03-16
|
||||
==================
|
||||
|
||||
* parser: if callback returns `false` ignore rest of payload
|
||||
* test: fixed all broken tests
|
||||
|
||||
0.2.1 / 2013-03-16
|
||||
==================
|
||||
|
||||
* added protocol version to index.js [albertyfwu]
|
||||
|
||||
0.2.0 / 2013-02-26
|
||||
==================
|
||||
|
||||
* Changed `decodePayload` to use a callback instead of returning an array [sweetieSong, albertyfwu]
|
||||
|
||||
0.1.1 / 2013-01-26
|
||||
==================
|
||||
|
||||
* package.json fixes
|
||||
|
||||
0.1.0 / 2013-01-19
|
||||
==================
|
||||
|
||||
* Initial release
|
22
node_modules/socket.io-client/node_modules/engine.io-parser/LICENSE
generated
vendored
Normal file
22
node_modules/socket.io-client/node_modules/engine.io-parser/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2016 Guillermo Rauch (@rauchg)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
202
node_modules/socket.io-client/node_modules/engine.io-parser/Readme.md
generated
vendored
Normal file
202
node_modules/socket.io-client/node_modules/engine.io-parser/Readme.md
generated
vendored
Normal file
@ -0,0 +1,202 @@
|
||||
|
||||
# engine.io-parser
|
||||
|
||||
[](http://travis-ci.org/socketio/engine.io-parser)
|
||||
[](http://badge.fury.io/js/engine.io-parser)
|
||||
|
||||
This is the JavaScript parser for the engine.io protocol encoding,
|
||||
shared by both
|
||||
[engine.io-client](https://github.com/socketio/engine.io-client) and
|
||||
[engine.io](https://github.com/socketio/engine.io).
|
||||
|
||||
## How to use
|
||||
|
||||
### Standalone
|
||||
|
||||
The parser can encode/decode packets, payloads, and payloads as binary
|
||||
with the following methods: `encodePacket`, `decodePacket`, `encodePayload`,
|
||||
`decodePayload`, `encodePayloadAsBinary`, `decodePayloadAsBinary`.
|
||||
|
||||
The browser-side parser also includes `encodePayloadAsArrayBuffer` and `encodePayloadAsBlob`.
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
var parser = require('engine.io-parser');
|
||||
|
||||
var data = new Buffer(5);
|
||||
for (var i = 0; i < data.length; i++) { data[i] = i; }
|
||||
|
||||
parser.encodePacket({ type: 'message', data: data }, function(encoded) {
|
||||
var decodedData = parser.decodePacket(encoded); // { type: 'message', data: data }
|
||||
});
|
||||
```
|
||||
|
||||
### With browserify
|
||||
|
||||
Engine.IO Parser is a commonjs module, which means you can include it by using
|
||||
`require` on the browser and package using [browserify](http://browserify.org/):
|
||||
|
||||
1. install the parser package
|
||||
|
||||
```shell
|
||||
npm install engine.io-parser
|
||||
```
|
||||
|
||||
1. write your app code
|
||||
|
||||
```js
|
||||
var parser = require('engine.io-parser');
|
||||
|
||||
var testBuffer = new Int8Array(10);
|
||||
for (var i = 0; i < testBuffer.length; i++) testBuffer[i] = i;
|
||||
|
||||
var packets = [{ type: 'message', data: testBuffer.buffer }, { type: 'message', data: 'hello' }];
|
||||
|
||||
parser.encodePayload(packets, function(encoded) {
|
||||
parser.decodePayload(encoded,
|
||||
function(packet, index, total) {
|
||||
var isLast = index + 1 == total;
|
||||
if (!isLast) {
|
||||
var buffer = new Int8Array(packet.data); // testBuffer
|
||||
} else {
|
||||
var message = packet.data; // 'hello'
|
||||
}
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
1. build your app bundle
|
||||
|
||||
```bash
|
||||
$ browserify app.js > bundle.js
|
||||
```
|
||||
|
||||
1. include on your page
|
||||
|
||||
```html
|
||||
<script src="/path/to/bundle.js"></script>
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- Runs on browser and node.js seamlessly
|
||||
- Runs inside HTML5 WebWorker
|
||||
- Can encode and decode packets
|
||||
- Encodes from/to ArrayBuffer or Blob when in browser, and Buffer or ArrayBuffer in Node
|
||||
|
||||
## API
|
||||
|
||||
Note: `cb(type)` means the type is a callback function that contains a parameter of type `type` when called.
|
||||
|
||||
### Node
|
||||
|
||||
- `encodePacket`
|
||||
- Encodes a packet.
|
||||
- **Parameters**
|
||||
- `Object`: the packet to encode, has `type` and `data`.
|
||||
- `data`: can be a `String`, `Number`, `Buffer`, `ArrayBuffer`
|
||||
- `Boolean`: optional, binary support
|
||||
- `Function`: callback, returns the encoded packet (`cb(String)`)
|
||||
- `decodePacket`
|
||||
- Decodes a packet. Data also available as an ArrayBuffer if requested.
|
||||
- Returns data as `String` or (`Blob` on browser, `ArrayBuffer` on Node)
|
||||
- **Parameters**
|
||||
- `String` | `ArrayBuffer`: the packet to decode, has `type` and `data`
|
||||
- `String`: optional, the binary type
|
||||
|
||||
- `encodeBase64Packet`
|
||||
- Encodes a packet with binary data in a base64 string (`String`)
|
||||
- **Parameters**
|
||||
- `Object`: the packet to encode, has `type` and `data`
|
||||
- `Function`: callback, returns the base64 encoded message (`cb(String)`)
|
||||
- `decodeBase64Packet`
|
||||
- Decodes a packet encoded in a base64 string.
|
||||
- **Parameters**
|
||||
- `String`: the base64 encoded message
|
||||
- `String`: optional, the binary type
|
||||
|
||||
- `encodePayload`
|
||||
- Encodes multiple messages (payload).
|
||||
- If any contents are binary, they will be encoded as base64 strings. Base64
|
||||
encoded strings are marked with a b before the length specifier
|
||||
- **Parameters**
|
||||
- `Array`: an array of packets
|
||||
- `Boolean`: optional, binary support
|
||||
- `Function`: callback, returns the encoded payload (`cb(String)`)
|
||||
- `decodePayload`
|
||||
- Decodes data when a payload is maybe expected. Possible binary contents are
|
||||
decoded from their base64 representation.
|
||||
- **Parameters**
|
||||
- `String`: the payload
|
||||
- `String`: optional, the binary type
|
||||
- `Function`: callback, returns (cb(`Object`: packet, `Number`:packet index, `Number`:packet total))
|
||||
|
||||
- `encodePayloadAsBinary`
|
||||
- Encodes multiple messages (payload) as binary.
|
||||
- **Parameters**
|
||||
- `Array`: an array of packets
|
||||
- `Function`: callback, returns the encoded payload (`cb(Buffer)`)
|
||||
- `decodePayloadAsBinary`
|
||||
- Decodes data when a payload is maybe expected. Strings are decoded by
|
||||
interpreting each byte as a key code for entries marked to start with 0. See
|
||||
description of encodePayloadAsBinary.
|
||||
- **Parameters**
|
||||
- `Buffer`: the buffer
|
||||
- `String`: optional, the binary type
|
||||
- `Function`: callback, returns the decoded packet (`cb(Object)`)
|
||||
|
||||
### Browser
|
||||
|
||||
- `encodePayloadAsArrayBuffer`
|
||||
- Encodes multiple messages (payload) as binary.
|
||||
- **Parameters**
|
||||
- `Array`: an array of packets
|
||||
- `Function`: callback, returns the encoded payload (`cb(ArrayBuffer)`)
|
||||
- `encodePayloadAsBlob`
|
||||
- Encodes multiple messages (payload) as blob.
|
||||
- **Parameters**
|
||||
- `Array`: an array of packets
|
||||
- `Function`: callback, returns the encoded payload (`cb(Blob)`)
|
||||
|
||||
## Tests
|
||||
|
||||
Standalone tests can be run with `make test` which will run both node.js and browser tests.
|
||||
|
||||
Browser tests are run using [zuul](https://github.com/defunctzombie/zuul).
|
||||
(You must have zuul setup with a saucelabs account.)
|
||||
|
||||
You can run the tests locally using the following command:
|
||||
|
||||
```
|
||||
./node_modules/.bin/zuul --local 8080 -- test/index.js
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
The support channels for `engine.io-parser` are the same as `socket.io`:
|
||||
- irc.freenode.net **#socket.io**
|
||||
- [Google Groups](http://groups.google.com/group/socket_io)
|
||||
- [Website](http://socket.io)
|
||||
|
||||
## Development
|
||||
|
||||
To contribute patches, run tests or benchmarks, make sure to clone the
|
||||
repository:
|
||||
|
||||
```bash
|
||||
git clone git://github.com/LearnBoost/engine.io-parser.git
|
||||
```
|
||||
|
||||
Then:
|
||||
|
||||
```bash
|
||||
cd engine.io-parser
|
||||
npm install
|
||||
```
|
||||
|
||||
See the `Tests` section above for how to run tests before submitting any patches.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
2
node_modules/socket.io-client/node_modules/engine.io-parser/index.js
generated
vendored
Normal file
2
node_modules/socket.io-client/node_modules/engine.io-parser/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
module.exports = require('./lib/');
|
609
node_modules/socket.io-client/node_modules/engine.io-parser/lib/browser.js
generated
vendored
Normal file
609
node_modules/socket.io-client/node_modules/engine.io-parser/lib/browser.js
generated
vendored
Normal file
@ -0,0 +1,609 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var keys = require('./keys');
|
||||
var hasBinary = require('has-binary');
|
||||
var sliceBuffer = require('arraybuffer.slice');
|
||||
var after = require('after');
|
||||
var utf8 = require('wtf-8');
|
||||
|
||||
var base64encoder;
|
||||
if (global && global.ArrayBuffer) {
|
||||
base64encoder = require('base64-arraybuffer');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we are running an android browser. That requires us to use
|
||||
* ArrayBuffer with polling transports...
|
||||
*
|
||||
* http://ghinda.net/jpeg-blob-ajax-android/
|
||||
*/
|
||||
|
||||
var isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent);
|
||||
|
||||
/**
|
||||
* Check if we are running in PhantomJS.
|
||||
* Uploading a Blob with PhantomJS does not work correctly, as reported here:
|
||||
* https://github.com/ariya/phantomjs/issues/11395
|
||||
* @type boolean
|
||||
*/
|
||||
var isPhantomJS = typeof navigator !== 'undefined' && /PhantomJS/i.test(navigator.userAgent);
|
||||
|
||||
/**
|
||||
* When true, avoids using Blobs to encode payloads.
|
||||
* @type boolean
|
||||
*/
|
||||
var dontSendBlobs = isAndroid || isPhantomJS;
|
||||
|
||||
/**
|
||||
* Current protocol version.
|
||||
*/
|
||||
|
||||
exports.protocol = 3;
|
||||
|
||||
/**
|
||||
* Packet types.
|
||||
*/
|
||||
|
||||
var packets = exports.packets = {
|
||||
open: 0 // non-ws
|
||||
, close: 1 // non-ws
|
||||
, ping: 2
|
||||
, pong: 3
|
||||
, message: 4
|
||||
, upgrade: 5
|
||||
, noop: 6
|
||||
};
|
||||
|
||||
var packetslist = keys(packets);
|
||||
|
||||
/**
|
||||
* Premade error packet.
|
||||
*/
|
||||
|
||||
var err = { type: 'error', data: 'parser error' };
|
||||
|
||||
/**
|
||||
* Create a blob api even for blob builder when vendor prefixes exist
|
||||
*/
|
||||
|
||||
var Blob = require('blob');
|
||||
|
||||
/**
|
||||
* Encodes a packet.
|
||||
*
|
||||
* <packet type id> [ <data> ]
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* 5hello world
|
||||
* 3
|
||||
* 4
|
||||
*
|
||||
* Binary is encoded in an identical principle
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) {
|
||||
if ('function' == typeof supportsBinary) {
|
||||
callback = supportsBinary;
|
||||
supportsBinary = false;
|
||||
}
|
||||
|
||||
if ('function' == typeof utf8encode) {
|
||||
callback = utf8encode;
|
||||
utf8encode = null;
|
||||
}
|
||||
|
||||
var data = (packet.data === undefined)
|
||||
? undefined
|
||||
: packet.data.buffer || packet.data;
|
||||
|
||||
if (global.ArrayBuffer && data instanceof ArrayBuffer) {
|
||||
return encodeArrayBuffer(packet, supportsBinary, callback);
|
||||
} else if (Blob && data instanceof global.Blob) {
|
||||
return encodeBlob(packet, supportsBinary, callback);
|
||||
}
|
||||
|
||||
// might be an object with { base64: true, data: dataAsBase64String }
|
||||
if (data && data.base64) {
|
||||
return encodeBase64Object(packet, callback);
|
||||
}
|
||||
|
||||
// Sending data as a utf-8 string
|
||||
var encoded = packets[packet.type];
|
||||
|
||||
// data fragment is optional
|
||||
if (undefined !== packet.data) {
|
||||
encoded += utf8encode ? utf8.encode(String(packet.data)) : String(packet.data);
|
||||
}
|
||||
|
||||
return callback('' + encoded);
|
||||
|
||||
};
|
||||
|
||||
function encodeBase64Object(packet, callback) {
|
||||
// packet data is an object { base64: true, data: dataAsBase64String }
|
||||
var message = 'b' + exports.packets[packet.type] + packet.data.data;
|
||||
return callback(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode packet helpers for binary types
|
||||
*/
|
||||
|
||||
function encodeArrayBuffer(packet, supportsBinary, callback) {
|
||||
if (!supportsBinary) {
|
||||
return exports.encodeBase64Packet(packet, callback);
|
||||
}
|
||||
|
||||
var data = packet.data;
|
||||
var contentArray = new Uint8Array(data);
|
||||
var resultBuffer = new Uint8Array(1 + data.byteLength);
|
||||
|
||||
resultBuffer[0] = packets[packet.type];
|
||||
for (var i = 0; i < contentArray.length; i++) {
|
||||
resultBuffer[i+1] = contentArray[i];
|
||||
}
|
||||
|
||||
return callback(resultBuffer.buffer);
|
||||
}
|
||||
|
||||
function encodeBlobAsArrayBuffer(packet, supportsBinary, callback) {
|
||||
if (!supportsBinary) {
|
||||
return exports.encodeBase64Packet(packet, callback);
|
||||
}
|
||||
|
||||
var fr = new FileReader();
|
||||
fr.onload = function() {
|
||||
packet.data = fr.result;
|
||||
exports.encodePacket(packet, supportsBinary, true, callback);
|
||||
};
|
||||
return fr.readAsArrayBuffer(packet.data);
|
||||
}
|
||||
|
||||
function encodeBlob(packet, supportsBinary, callback) {
|
||||
if (!supportsBinary) {
|
||||
return exports.encodeBase64Packet(packet, callback);
|
||||
}
|
||||
|
||||
if (dontSendBlobs) {
|
||||
return encodeBlobAsArrayBuffer(packet, supportsBinary, callback);
|
||||
}
|
||||
|
||||
var length = new Uint8Array(1);
|
||||
length[0] = packets[packet.type];
|
||||
var blob = new Blob([length.buffer, packet.data]);
|
||||
|
||||
return callback(blob);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes a packet with binary data in a base64 string
|
||||
*
|
||||
* @param {Object} packet, has `type` and `data`
|
||||
* @return {String} base64 encoded message
|
||||
*/
|
||||
|
||||
exports.encodeBase64Packet = function(packet, callback) {
|
||||
var message = 'b' + exports.packets[packet.type];
|
||||
if (Blob && packet.data instanceof global.Blob) {
|
||||
var fr = new FileReader();
|
||||
fr.onload = function() {
|
||||
var b64 = fr.result.split(',')[1];
|
||||
callback(message + b64);
|
||||
};
|
||||
return fr.readAsDataURL(packet.data);
|
||||
}
|
||||
|
||||
var b64data;
|
||||
try {
|
||||
b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data));
|
||||
} catch (e) {
|
||||
// iPhone Safari doesn't let you apply with typed arrays
|
||||
var typed = new Uint8Array(packet.data);
|
||||
var basic = new Array(typed.length);
|
||||
for (var i = 0; i < typed.length; i++) {
|
||||
basic[i] = typed[i];
|
||||
}
|
||||
b64data = String.fromCharCode.apply(null, basic);
|
||||
}
|
||||
message += global.btoa(b64data);
|
||||
return callback(message);
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a packet. Changes format to Blob if requested.
|
||||
*
|
||||
* @return {Object} with `type` and `data` (if any)
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.decodePacket = function (data, binaryType, utf8decode) {
|
||||
if (data === undefined) {
|
||||
return err;
|
||||
}
|
||||
// String data
|
||||
if (typeof data == 'string') {
|
||||
if (data.charAt(0) == 'b') {
|
||||
return exports.decodeBase64Packet(data.substr(1), binaryType);
|
||||
}
|
||||
|
||||
if (utf8decode) {
|
||||
data = tryDecode(data);
|
||||
if (data === false) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
var type = data.charAt(0);
|
||||
|
||||
if (Number(type) != type || !packetslist[type]) {
|
||||
return err;
|
||||
}
|
||||
|
||||
if (data.length > 1) {
|
||||
return { type: packetslist[type], data: data.substring(1) };
|
||||
} else {
|
||||
return { type: packetslist[type] };
|
||||
}
|
||||
}
|
||||
|
||||
var asArray = new Uint8Array(data);
|
||||
var type = asArray[0];
|
||||
var rest = sliceBuffer(data, 1);
|
||||
if (Blob && binaryType === 'blob') {
|
||||
rest = new Blob([rest]);
|
||||
}
|
||||
return { type: packetslist[type], data: rest };
|
||||
};
|
||||
|
||||
function tryDecode(data) {
|
||||
try {
|
||||
data = utf8.decode(data);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a packet encoded in a base64 string
|
||||
*
|
||||
* @param {String} base64 encoded message
|
||||
* @return {Object} with `type` and `data` (if any)
|
||||
*/
|
||||
|
||||
exports.decodeBase64Packet = function(msg, binaryType) {
|
||||
var type = packetslist[msg.charAt(0)];
|
||||
if (!base64encoder) {
|
||||
return { type: type, data: { base64: true, data: msg.substr(1) } };
|
||||
}
|
||||
|
||||
var data = base64encoder.decode(msg.substr(1));
|
||||
|
||||
if (binaryType === 'blob' && Blob) {
|
||||
data = new Blob([data]);
|
||||
}
|
||||
|
||||
return { type: type, data: data };
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes multiple messages (payload).
|
||||
*
|
||||
* <length>:data
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* 11:hello world2:hi
|
||||
*
|
||||
* If any contents are binary, they will be encoded as base64 strings. Base64
|
||||
* encoded strings are marked with a b before the length specifier
|
||||
*
|
||||
* @param {Array} packets
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.encodePayload = function (packets, supportsBinary, callback) {
|
||||
if (typeof supportsBinary == 'function') {
|
||||
callback = supportsBinary;
|
||||
supportsBinary = null;
|
||||
}
|
||||
|
||||
var isBinary = hasBinary(packets);
|
||||
|
||||
if (supportsBinary && isBinary) {
|
||||
if (Blob && !dontSendBlobs) {
|
||||
return exports.encodePayloadAsBlob(packets, callback);
|
||||
}
|
||||
|
||||
return exports.encodePayloadAsArrayBuffer(packets, callback);
|
||||
}
|
||||
|
||||
if (!packets.length) {
|
||||
return callback('0:');
|
||||
}
|
||||
|
||||
function setLengthHeader(message) {
|
||||
return message.length + ':' + message;
|
||||
}
|
||||
|
||||
function encodeOne(packet, doneCallback) {
|
||||
exports.encodePacket(packet, !isBinary ? false : supportsBinary, true, function(message) {
|
||||
doneCallback(null, setLengthHeader(message));
|
||||
});
|
||||
}
|
||||
|
||||
map(packets, encodeOne, function(err, results) {
|
||||
return callback(results.join(''));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Async array map using after
|
||||
*/
|
||||
|
||||
function map(ary, each, done) {
|
||||
var result = new Array(ary.length);
|
||||
var next = after(ary.length, done);
|
||||
|
||||
var eachWithIndex = function(i, el, cb) {
|
||||
each(el, function(error, msg) {
|
||||
result[i] = msg;
|
||||
cb(error, result);
|
||||
});
|
||||
};
|
||||
|
||||
for (var i = 0; i < ary.length; i++) {
|
||||
eachWithIndex(i, ary[i], next);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Decodes data when a payload is maybe expected. Possible binary contents are
|
||||
* decoded from their base64 representation
|
||||
*
|
||||
* @param {String} data, callback method
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.decodePayload = function (data, binaryType, callback) {
|
||||
if (typeof data != 'string') {
|
||||
return exports.decodePayloadAsBinary(data, binaryType, callback);
|
||||
}
|
||||
|
||||
if (typeof binaryType === 'function') {
|
||||
callback = binaryType;
|
||||
binaryType = null;
|
||||
}
|
||||
|
||||
var packet;
|
||||
if (data == '') {
|
||||
// parser error - ignoring payload
|
||||
return callback(err, 0, 1);
|
||||
}
|
||||
|
||||
var length = ''
|
||||
, n, msg;
|
||||
|
||||
for (var i = 0, l = data.length; i < l; i++) {
|
||||
var chr = data.charAt(i);
|
||||
|
||||
if (':' != chr) {
|
||||
length += chr;
|
||||
} else {
|
||||
if ('' == length || (length != (n = Number(length)))) {
|
||||
// parser error - ignoring payload
|
||||
return callback(err, 0, 1);
|
||||
}
|
||||
|
||||
msg = data.substr(i + 1, n);
|
||||
|
||||
if (length != msg.length) {
|
||||
// parser error - ignoring payload
|
||||
return callback(err, 0, 1);
|
||||
}
|
||||
|
||||
if (msg.length) {
|
||||
packet = exports.decodePacket(msg, binaryType, true);
|
||||
|
||||
if (err.type == packet.type && err.data == packet.data) {
|
||||
// parser error in individual packet - ignoring payload
|
||||
return callback(err, 0, 1);
|
||||
}
|
||||
|
||||
var ret = callback(packet, i + n, l);
|
||||
if (false === ret) return;
|
||||
}
|
||||
|
||||
// advance cursor
|
||||
i += n;
|
||||
length = '';
|
||||
}
|
||||
}
|
||||
|
||||
if (length != '') {
|
||||
// parser error - ignoring payload
|
||||
return callback(err, 0, 1);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes multiple messages (payload) as binary.
|
||||
*
|
||||
* <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number
|
||||
* 255><data>
|
||||
*
|
||||
* Example:
|
||||
* 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers
|
||||
*
|
||||
* @param {Array} packets
|
||||
* @return {ArrayBuffer} encoded payload
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.encodePayloadAsArrayBuffer = function(packets, callback) {
|
||||
if (!packets.length) {
|
||||
return callback(new ArrayBuffer(0));
|
||||
}
|
||||
|
||||
function encodeOne(packet, doneCallback) {
|
||||
exports.encodePacket(packet, true, true, function(data) {
|
||||
return doneCallback(null, data);
|
||||
});
|
||||
}
|
||||
|
||||
map(packets, encodeOne, function(err, encodedPackets) {
|
||||
var totalLength = encodedPackets.reduce(function(acc, p) {
|
||||
var len;
|
||||
if (typeof p === 'string'){
|
||||
len = p.length;
|
||||
} else {
|
||||
len = p.byteLength;
|
||||
}
|
||||
return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2
|
||||
}, 0);
|
||||
|
||||
var resultArray = new Uint8Array(totalLength);
|
||||
|
||||
var bufferIndex = 0;
|
||||
encodedPackets.forEach(function(p) {
|
||||
var isString = typeof p === 'string';
|
||||
var ab = p;
|
||||
if (isString) {
|
||||
var view = new Uint8Array(p.length);
|
||||
for (var i = 0; i < p.length; i++) {
|
||||
view[i] = p.charCodeAt(i);
|
||||
}
|
||||
ab = view.buffer;
|
||||
}
|
||||
|
||||
if (isString) { // not true binary
|
||||
resultArray[bufferIndex++] = 0;
|
||||
} else { // true binary
|
||||
resultArray[bufferIndex++] = 1;
|
||||
}
|
||||
|
||||
var lenStr = ab.byteLength.toString();
|
||||
for (var i = 0; i < lenStr.length; i++) {
|
||||
resultArray[bufferIndex++] = parseInt(lenStr[i]);
|
||||
}
|
||||
resultArray[bufferIndex++] = 255;
|
||||
|
||||
var view = new Uint8Array(ab);
|
||||
for (var i = 0; i < view.length; i++) {
|
||||
resultArray[bufferIndex++] = view[i];
|
||||
}
|
||||
});
|
||||
|
||||
return callback(resultArray.buffer);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Encode as Blob
|
||||
*/
|
||||
|
||||
exports.encodePayloadAsBlob = function(packets, callback) {
|
||||
function encodeOne(packet, doneCallback) {
|
||||
exports.encodePacket(packet, true, true, function(encoded) {
|
||||
var binaryIdentifier = new Uint8Array(1);
|
||||
binaryIdentifier[0] = 1;
|
||||
if (typeof encoded === 'string') {
|
||||
var view = new Uint8Array(encoded.length);
|
||||
for (var i = 0; i < encoded.length; i++) {
|
||||
view[i] = encoded.charCodeAt(i);
|
||||
}
|
||||
encoded = view.buffer;
|
||||
binaryIdentifier[0] = 0;
|
||||
}
|
||||
|
||||
var len = (encoded instanceof ArrayBuffer)
|
||||
? encoded.byteLength
|
||||
: encoded.size;
|
||||
|
||||
var lenStr = len.toString();
|
||||
var lengthAry = new Uint8Array(lenStr.length + 1);
|
||||
for (var i = 0; i < lenStr.length; i++) {
|
||||
lengthAry[i] = parseInt(lenStr[i]);
|
||||
}
|
||||
lengthAry[lenStr.length] = 255;
|
||||
|
||||
if (Blob) {
|
||||
var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]);
|
||||
doneCallback(null, blob);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
map(packets, encodeOne, function(err, results) {
|
||||
return callback(new Blob(results));
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Decodes data when a payload is maybe expected. Strings are decoded by
|
||||
* interpreting each byte as a key code for entries marked to start with 0. See
|
||||
* description of encodePayloadAsBinary
|
||||
*
|
||||
* @param {ArrayBuffer} data, callback method
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.decodePayloadAsBinary = function (data, binaryType, callback) {
|
||||
if (typeof binaryType === 'function') {
|
||||
callback = binaryType;
|
||||
binaryType = null;
|
||||
}
|
||||
|
||||
var bufferTail = data;
|
||||
var buffers = [];
|
||||
|
||||
var numberTooLong = false;
|
||||
while (bufferTail.byteLength > 0) {
|
||||
var tailArray = new Uint8Array(bufferTail);
|
||||
var isString = tailArray[0] === 0;
|
||||
var msgLength = '';
|
||||
|
||||
for (var i = 1; ; i++) {
|
||||
if (tailArray[i] == 255) break;
|
||||
|
||||
if (msgLength.length > 310) {
|
||||
numberTooLong = true;
|
||||
break;
|
||||
}
|
||||
|
||||
msgLength += tailArray[i];
|
||||
}
|
||||
|
||||
if(numberTooLong) return callback(err, 0, 1);
|
||||
|
||||
bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length);
|
||||
msgLength = parseInt(msgLength);
|
||||
|
||||
var msg = sliceBuffer(bufferTail, 0, msgLength);
|
||||
if (isString) {
|
||||
try {
|
||||
msg = String.fromCharCode.apply(null, new Uint8Array(msg));
|
||||
} catch (e) {
|
||||
// iPhone Safari doesn't let you apply to typed arrays
|
||||
var typed = new Uint8Array(msg);
|
||||
msg = '';
|
||||
for (var i = 0; i < typed.length; i++) {
|
||||
msg += String.fromCharCode(typed[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buffers.push(msg);
|
||||
bufferTail = sliceBuffer(bufferTail, msgLength);
|
||||
}
|
||||
|
||||
var total = buffers.length;
|
||||
buffers.forEach(function(buffer, i) {
|
||||
callback(exports.decodePacket(buffer, binaryType, true), i, total);
|
||||
});
|
||||
};
|
474
node_modules/socket.io-client/node_modules/engine.io-parser/lib/index.js
generated
vendored
Normal file
474
node_modules/socket.io-client/node_modules/engine.io-parser/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,474 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var utf8 = require('wtf-8');
|
||||
var after = require('after');
|
||||
var keys = require('./keys');
|
||||
|
||||
/**
|
||||
* Current protocol version.
|
||||
*/
|
||||
exports.protocol = 3;
|
||||
|
||||
/**
|
||||
* Packet types.
|
||||
*/
|
||||
|
||||
var packets = exports.packets = {
|
||||
open: 0 // non-ws
|
||||
, close: 1 // non-ws
|
||||
, ping: 2
|
||||
, pong: 3
|
||||
, message: 4
|
||||
, upgrade: 5
|
||||
, noop: 6
|
||||
};
|
||||
|
||||
var packetslist = keys(packets);
|
||||
|
||||
/**
|
||||
* Premade error packet.
|
||||
*/
|
||||
|
||||
var err = { type: 'error', data: 'parser error' };
|
||||
|
||||
/**
|
||||
* Encodes a packet.
|
||||
*
|
||||
* <packet type id> [ <data> ]
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* 5hello world
|
||||
* 3
|
||||
* 4
|
||||
*
|
||||
* Binary is encoded in an identical principle
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) {
|
||||
if ('function' == typeof supportsBinary) {
|
||||
callback = supportsBinary;
|
||||
supportsBinary = null;
|
||||
}
|
||||
|
||||
if ('function' == typeof utf8encode ) {
|
||||
callback = utf8encode;
|
||||
utf8encode = null;
|
||||
}
|
||||
|
||||
if (Buffer.isBuffer(packet.data)) {
|
||||
return encodeBuffer(packet, supportsBinary, callback);
|
||||
} else if (packet.data && (packet.data.buffer || packet.data) instanceof ArrayBuffer) {
|
||||
packet.data = arrayBufferToBuffer(packet.data);
|
||||
return encodeBuffer(packet, supportsBinary, callback);
|
||||
}
|
||||
|
||||
// Sending data as a utf-8 string
|
||||
var encoded = packets[packet.type];
|
||||
|
||||
// data fragment is optional
|
||||
if (undefined !== packet.data) {
|
||||
encoded += utf8encode ? utf8.encode(String(packet.data)) : String(packet.data);
|
||||
}
|
||||
|
||||
return callback('' + encoded);
|
||||
};
|
||||
|
||||
/**
|
||||
* Encode Buffer data
|
||||
*/
|
||||
|
||||
function encodeBuffer(packet, supportsBinary, callback) {
|
||||
var data = packet.data;
|
||||
if (!supportsBinary) {
|
||||
return exports.encodeBase64Packet(packet, callback);
|
||||
}
|
||||
|
||||
var typeBuffer = new Buffer(1);
|
||||
typeBuffer[0] = packets[packet.type];
|
||||
return callback(Buffer.concat([typeBuffer, data]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes a packet with binary data in a base64 string
|
||||
*
|
||||
* @param {Object} packet, has `type` and `data`
|
||||
* @return {String} base64 encoded message
|
||||
*/
|
||||
|
||||
exports.encodeBase64Packet = function(packet, callback){
|
||||
if (!Buffer.isBuffer(packet.data)) {
|
||||
packet.data = arrayBufferToBuffer(packet.data);
|
||||
}
|
||||
|
||||
var message = 'b' + packets[packet.type];
|
||||
message += packet.data.toString('base64');
|
||||
return callback(message);
|
||||
};
|
||||
|
||||
/**
|
||||
* Decodes a packet. Data also available as an ArrayBuffer if requested.
|
||||
*
|
||||
* @return {Object} with `type` and `data` (if any)
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.decodePacket = function (data, binaryType, utf8decode) {
|
||||
if (data === undefined) {
|
||||
return err;
|
||||
}
|
||||
// String data
|
||||
if (typeof data == 'string') {
|
||||
if (data.charAt(0) == 'b') {
|
||||
return exports.decodeBase64Packet(data.substr(1), binaryType);
|
||||
}
|
||||
|
||||
var type = data.charAt(0);
|
||||
|
||||
if (utf8decode) {
|
||||
data = tryDecode(data);
|
||||
if (data === false) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
if (Number(type) != type || !packetslist[type]) {
|
||||
return err;
|
||||
}
|
||||
|
||||
if (data.length > 1) {
|
||||
return { type: packetslist[type], data: data.substring(1) };
|
||||
} else {
|
||||
return { type: packetslist[type] };
|
||||
}
|
||||
}
|
||||
|
||||
// Binary data
|
||||
if (binaryType === 'arraybuffer') {
|
||||
// wrap Buffer/ArrayBuffer data into an Uint8Array
|
||||
var intArray = new Uint8Array(data);
|
||||
var type = intArray[0];
|
||||
return { type: packetslist[type], data: intArray.buffer.slice(1) };
|
||||
}
|
||||
|
||||
if (data instanceof ArrayBuffer) {
|
||||
data = arrayBufferToBuffer(data);
|
||||
}
|
||||
var type = data[0];
|
||||
return { type: packetslist[type], data: data.slice(1) };
|
||||
};
|
||||
|
||||
function tryDecode(data) {
|
||||
try {
|
||||
data = utf8.decode(data);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a packet encoded in a base64 string.
|
||||
*
|
||||
* @param {String} base64 encoded message
|
||||
* @return {Object} with `type` and `data` (if any)
|
||||
*/
|
||||
|
||||
exports.decodeBase64Packet = function(msg, binaryType) {
|
||||
var type = packetslist[msg.charAt(0)];
|
||||
var data = new Buffer(msg.substr(1), 'base64');
|
||||
if (binaryType === 'arraybuffer') {
|
||||
var abv = new Uint8Array(data.length);
|
||||
for (var i = 0; i < abv.length; i++){
|
||||
abv[i] = data[i];
|
||||
}
|
||||
data = abv.buffer;
|
||||
}
|
||||
return { type: type, data: data };
|
||||
};
|
||||
|
||||
/**
|
||||
* Encodes multiple messages (payload).
|
||||
*
|
||||
* <length>:data
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* 11:hello world2:hi
|
||||
*
|
||||
* If any contents are binary, they will be encoded as base64 strings. Base64
|
||||
* encoded strings are marked with a b before the length specifier
|
||||
*
|
||||
* @param {Array} packets
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.encodePayload = function (packets, supportsBinary, callback) {
|
||||
if (typeof supportsBinary == 'function') {
|
||||
callback = supportsBinary;
|
||||
supportsBinary = null;
|
||||
}
|
||||
|
||||
if (supportsBinary) {
|
||||
return exports.encodePayloadAsBinary(packets, callback);
|
||||
}
|
||||
|
||||
if (!packets.length) {
|
||||
return callback('0:');
|
||||
}
|
||||
|
||||
function setLengthHeader(message) {
|
||||
return message.length + ':' + message;
|
||||
}
|
||||
|
||||
function encodeOne(packet, doneCallback) {
|
||||
exports.encodePacket(packet, supportsBinary, true, function(message) {
|
||||
doneCallback(null, setLengthHeader(message));
|
||||
});
|
||||
}
|
||||
|
||||
map(packets, encodeOne, function(err, results) {
|
||||
return callback(results.join(''));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Async array map using after
|
||||
*/
|
||||
|
||||
function map(ary, each, done) {
|
||||
var result = new Array(ary.length);
|
||||
var next = after(ary.length, done);
|
||||
|
||||
var eachWithIndex = function(i, el, cb) {
|
||||
each(el, function(error, msg) {
|
||||
result[i] = msg;
|
||||
cb(error, result);
|
||||
});
|
||||
};
|
||||
|
||||
for (var i = 0; i < ary.length; i++) {
|
||||
eachWithIndex(i, ary[i], next);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Decodes data when a payload is maybe expected. Possible binary contents are
|
||||
* decoded from their base64 representation
|
||||
*
|
||||
* @param {String} data, callback method
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.decodePayload = function (data, binaryType, callback) {
|
||||
if ('string' != typeof data) {
|
||||
return exports.decodePayloadAsBinary(data, binaryType, callback);
|
||||
}
|
||||
|
||||
if (typeof binaryType === 'function') {
|
||||
callback = binaryType;
|
||||
binaryType = null;
|
||||
}
|
||||
|
||||
var packet;
|
||||
if (data == '') {
|
||||
// parser error - ignoring payload
|
||||
return callback(err, 0, 1);
|
||||
}
|
||||
|
||||
var length = ''
|
||||
, n, msg;
|
||||
|
||||
for (var i = 0, l = data.length; i < l; i++) {
|
||||
var chr = data.charAt(i);
|
||||
|
||||
if (':' != chr) {
|
||||
length += chr;
|
||||
} else {
|
||||
if ('' == length || (length != (n = Number(length)))) {
|
||||
// parser error - ignoring payload
|
||||
return callback(err, 0, 1);
|
||||
}
|
||||
|
||||
msg = data.substr(i + 1, n);
|
||||
|
||||
if (length != msg.length) {
|
||||
// parser error - ignoring payload
|
||||
return callback(err, 0, 1);
|
||||
}
|
||||
|
||||
if (msg.length) {
|
||||
packet = exports.decodePacket(msg, binaryType, true);
|
||||
|
||||
if (err.type == packet.type && err.data == packet.data) {
|
||||
// parser error in individual packet - ignoring payload
|
||||
return callback(err, 0, 1);
|
||||
}
|
||||
|
||||
var ret = callback(packet, i + n, l);
|
||||
if (false === ret) return;
|
||||
}
|
||||
|
||||
// advance cursor
|
||||
i += n;
|
||||
length = '';
|
||||
}
|
||||
}
|
||||
|
||||
if (length != '') {
|
||||
// parser error - ignoring payload
|
||||
return callback(err, 0, 1);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* Converts a buffer to a utf8.js encoded string
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function bufferToString(buffer) {
|
||||
var str = '';
|
||||
for (var i = 0; i < buffer.length; i++) {
|
||||
str += String.fromCharCode(buffer[i]);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Converts a utf8.js encoded string to a buffer
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function stringToBuffer(string) {
|
||||
var buf = new Buffer(string.length);
|
||||
for (var i = 0; i < string.length; i++) {
|
||||
buf.writeUInt8(string.charCodeAt(i), i);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Converts an ArrayBuffer to a Buffer
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function arrayBufferToBuffer(data) {
|
||||
// data is either an ArrayBuffer or ArrayBufferView.
|
||||
var array = new Uint8Array(data.buffer || data);
|
||||
var length = data.byteLength || data.length;
|
||||
var offset = data.byteOffset || 0;
|
||||
var buffer = new Buffer(length);
|
||||
|
||||
for (var i = 0; i < length; i++) {
|
||||
buffer[i] = array[offset + i];
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes multiple messages (payload) as binary.
|
||||
*
|
||||
* <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number
|
||||
* 255><data>
|
||||
*
|
||||
* Example:
|
||||
* 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers
|
||||
*
|
||||
* @param {Array} packets
|
||||
* @return {Buffer} encoded payload
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.encodePayloadAsBinary = function (packets, callback) {
|
||||
if (!packets.length) {
|
||||
return callback(new Buffer(0));
|
||||
}
|
||||
|
||||
function encodeOne(p, doneCallback) {
|
||||
exports.encodePacket(p, true, true, function(packet) {
|
||||
|
||||
if (typeof packet === 'string') {
|
||||
var encodingLength = '' + packet.length;
|
||||
var sizeBuffer = new Buffer(encodingLength.length + 2);
|
||||
sizeBuffer[0] = 0; // is a string (not true binary = 0)
|
||||
for (var i = 0; i < encodingLength.length; i++) {
|
||||
sizeBuffer[i + 1] = parseInt(encodingLength[i], 10);
|
||||
}
|
||||
sizeBuffer[sizeBuffer.length - 1] = 255;
|
||||
return doneCallback(null, Buffer.concat([sizeBuffer, stringToBuffer(packet)]));
|
||||
}
|
||||
|
||||
var encodingLength = '' + packet.length;
|
||||
var sizeBuffer = new Buffer(encodingLength.length + 2);
|
||||
sizeBuffer[0] = 1; // is binary (true binary = 1)
|
||||
for (var i = 0; i < encodingLength.length; i++) {
|
||||
sizeBuffer[i + 1] = parseInt(encodingLength[i], 10);
|
||||
}
|
||||
sizeBuffer[sizeBuffer.length - 1] = 255;
|
||||
doneCallback(null, Buffer.concat([sizeBuffer, packet]));
|
||||
});
|
||||
}
|
||||
|
||||
map(packets, encodeOne, function(err, results) {
|
||||
return callback(Buffer.concat(results));
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* Decodes data when a payload is maybe expected. Strings are decoded by
|
||||
* interpreting each byte as a key code for entries marked to start with 0. See
|
||||
* description of encodePayloadAsBinary
|
||||
|
||||
* @param {Buffer} data, callback method
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.decodePayloadAsBinary = function (data, binaryType, callback) {
|
||||
if (typeof binaryType === 'function') {
|
||||
callback = binaryType;
|
||||
binaryType = null;
|
||||
}
|
||||
|
||||
var bufferTail = data;
|
||||
var buffers = [];
|
||||
|
||||
while (bufferTail.length > 0) {
|
||||
var strLen = '';
|
||||
var isString = bufferTail[0] === 0;
|
||||
var numberTooLong = false;
|
||||
for (var i = 1; ; i++) {
|
||||
if (bufferTail[i] == 255) break;
|
||||
// 310 = char length of Number.MAX_VALUE
|
||||
if (strLen.length > 310) {
|
||||
numberTooLong = true;
|
||||
break;
|
||||
}
|
||||
strLen += '' + bufferTail[i];
|
||||
}
|
||||
if(numberTooLong) return callback(err, 0, 1);
|
||||
bufferTail = bufferTail.slice(strLen.length + 1);
|
||||
|
||||
var msgLength = parseInt(strLen, 10);
|
||||
|
||||
var msg = bufferTail.slice(1, msgLength + 1);
|
||||
if (isString) msg = bufferToString(msg);
|
||||
buffers.push(msg);
|
||||
bufferTail = bufferTail.slice(msgLength + 1);
|
||||
}
|
||||
|
||||
var total = buffers.length;
|
||||
buffers.forEach(function(buffer, i) {
|
||||
callback(exports.decodePacket(buffer, binaryType, true), i, total);
|
||||
});
|
||||
};
|
19
node_modules/socket.io-client/node_modules/engine.io-parser/lib/keys.js
generated
vendored
Normal file
19
node_modules/socket.io-client/node_modules/engine.io-parser/lib/keys.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
/**
|
||||
* Gets the keys for an object.
|
||||
*
|
||||
* @return {Array} keys
|
||||
* @api private
|
||||
*/
|
||||
|
||||
module.exports = Object.keys || function keys (obj){
|
||||
var arr = [];
|
||||
var has = Object.prototype.hasOwnProperty;
|
||||
|
||||
for (var i in obj) {
|
||||
if (has.call(obj, i)) {
|
||||
arr.push(i);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
};
|
15
node_modules/socket.io-client/node_modules/engine.io-parser/node_modules/has-binary/.npmignore
generated
vendored
Normal file
15
node_modules/socket.io-client/node_modules/engine.io-parser/node_modules/has-binary/.npmignore
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
lib-cov
|
||||
*.seed
|
||||
*.log
|
||||
*.csv
|
||||
*.dat
|
||||
*.out
|
||||
*.pid
|
||||
*.gz
|
||||
|
||||
pids
|
||||
logs
|
||||
results
|
||||
|
||||
npm-debug.log
|
||||
node_modules
|
11
node_modules/socket.io-client/node_modules/engine.io-parser/node_modules/has-binary/History.md
generated
vendored
Normal file
11
node_modules/socket.io-client/node_modules/engine.io-parser/node_modules/has-binary/History.md
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
0.1.6 / 2015-01-24
|
||||
==================
|
||||
|
||||
* fix "undefined function" bug when iterating
|
||||
an object created with Object.create(null) [gunta]
|
||||
|
||||
0.1.5 / 2014-09-04
|
||||
==================
|
||||
|
||||
* prevent browserify from bundling `Buffer`
|
20
node_modules/socket.io-client/node_modules/engine.io-parser/node_modules/has-binary/LICENSE
generated
vendored
Normal file
20
node_modules/socket.io-client/node_modules/engine.io-parser/node_modules/has-binary/LICENSE
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Kevin Roark
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
3
node_modules/socket.io-client/node_modules/engine.io-parser/node_modules/has-binary/Makefile
generated
vendored
Normal file
3
node_modules/socket.io-client/node_modules/engine.io-parser/node_modules/has-binary/Makefile
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
test:
|
||||
@./node_modules/.bin/mocha test.js
|
4
node_modules/socket.io-client/node_modules/engine.io-parser/node_modules/has-binary/README.md
generated
vendored
Normal file
4
node_modules/socket.io-client/node_modules/engine.io-parser/node_modules/has-binary/README.md
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
has-binarydata.js
|
||||
=================
|
||||
|
||||
Simple module to test if an object contains binary data
|
1
node_modules/socket.io-client/node_modules/engine.io-parser/node_modules/has-binary/fixtures/big.json
generated
vendored
Normal file
1
node_modules/socket.io-client/node_modules/engine.io-parser/node_modules/has-binary/fixtures/big.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
58
node_modules/socket.io-client/node_modules/engine.io-parser/node_modules/has-binary/index.js
generated
vendored
Normal file
58
node_modules/socket.io-client/node_modules/engine.io-parser/node_modules/has-binary/index.js
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
|
||||
/*
|
||||
* Module requirements.
|
||||
*/
|
||||
|
||||
var isArray = require('isarray');
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = hasBinary;
|
||||
|
||||
/**
|
||||
* Checks for binary data.
|
||||
*
|
||||
* Right now only Buffer and ArrayBuffer are supported..
|
||||
*
|
||||
* @param {Object} anything
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function hasBinary(data) {
|
||||
|
||||
function _hasBinary(obj) {
|
||||
if (!obj) return false;
|
||||
|
||||
if ( (global.Buffer && global.Buffer.isBuffer(obj)) ||
|
||||
(global.ArrayBuffer && obj instanceof ArrayBuffer) ||
|
||||
(global.Blob && obj instanceof Blob) ||
|
||||
(global.File && obj instanceof File)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isArray(obj)) {
|
||||
for (var i = 0; i < obj.length; i++) {
|
||||
if (_hasBinary(obj[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (obj && 'object' == typeof obj) {
|
||||
if (obj.toJSON) {
|
||||
obj = obj.toJSON();
|
||||
}
|
||||
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key) && _hasBinary(obj[key])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return _hasBinary(data);
|
||||
}
|
84
node_modules/socket.io-client/node_modules/engine.io-parser/node_modules/has-binary/package.json
generated
vendored
Normal file
84
node_modules/socket.io-client/node_modules/engine.io-parser/node_modules/has-binary/package.json
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "has-binary@0.1.6",
|
||||
"scope": null,
|
||||
"escapedName": "has-binary",
|
||||
"name": "has-binary",
|
||||
"rawSpec": "0.1.6",
|
||||
"spec": "0.1.6",
|
||||
"type": "version"
|
||||
},
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\socket.io\\node_modules\\engine.io-parser"
|
||||
],
|
||||
[
|
||||
{
|
||||
"raw": "has-binary@0.1.6",
|
||||
"scope": null,
|
||||
"escapedName": "has-binary",
|
||||
"name": "has-binary",
|
||||
"rawSpec": "0.1.6",
|
||||
"spec": "0.1.6",
|
||||
"type": "version"
|
||||
},
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\socket.io-client\\node_modules\\engine.io-parser"
|
||||
]
|
||||
],
|
||||
"_from": "has-binary@0.1.6",
|
||||
"_id": "has-binary@0.1.6",
|
||||
"_inCache": true,
|
||||
"_location": "/socket.io-client/engine.io-parser/has-binary",
|
||||
"_npmUser": {
|
||||
"name": "rauchg",
|
||||
"email": "rauchg@gmail.com"
|
||||
},
|
||||
"_npmVersion": "1.4.28",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "has-binary@0.1.6",
|
||||
"scope": null,
|
||||
"escapedName": "has-binary",
|
||||
"name": "has-binary",
|
||||
"rawSpec": "0.1.6",
|
||||
"spec": "0.1.6",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/socket.io-client/engine.io-parser"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/has-binary/-/has-binary-0.1.6.tgz",
|
||||
"_shasum": "25326f39cfa4f616ad8787894e3af2cfbc7b6e10",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "has-binary@0.1.6",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\socket.io-client\\node_modules\\engine.io-parser",
|
||||
"author": {
|
||||
"name": "Kevin Roark"
|
||||
},
|
||||
"dependencies": {
|
||||
"isarray": "0.0.1"
|
||||
},
|
||||
"description": "A function that takes anything in javascript and returns true if its argument contains binary data.",
|
||||
"devDependencies": {
|
||||
"better-assert": "1.0.0",
|
||||
"mocha": "1.17.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "25326f39cfa4f616ad8787894e3af2cfbc7b6e10",
|
||||
"tarball": "https://registry.npmjs.org/has-binary/-/has-binary-0.1.6.tgz"
|
||||
},
|
||||
"gitHead": "a37d7ed88fb88e49d5ed1ca15e6cc7dd004dd0e8",
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "rauchg",
|
||||
"email": "rauchg@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "has-binary",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"scripts": {},
|
||||
"version": "0.1.6"
|
||||
}
|
108
node_modules/socket.io-client/node_modules/engine.io-parser/node_modules/has-binary/test.js
generated
vendored
Normal file
108
node_modules/socket.io-client/node_modules/engine.io-parser/node_modules/has-binary/test.js
generated
vendored
Normal file
@ -0,0 +1,108 @@
|
||||
|
||||
var hasBinary = require('./');
|
||||
var assert = require('better-assert');
|
||||
var fs = require('fs');
|
||||
|
||||
var start = new Date();
|
||||
|
||||
describe('has-binarydata', function(){
|
||||
|
||||
it('should work with buffer', function(){
|
||||
assert(hasBinary(fs.readFileSync('./test.js')));
|
||||
});
|
||||
|
||||
it('should work with an array that does not contain binary', function() {
|
||||
var arr = [1, 'cool', 2];
|
||||
assert(!hasBinary(arr));
|
||||
});
|
||||
|
||||
it('should work with an array that contains a buffer', function() {
|
||||
var arr = [1, new Buffer('asdfasdf', 'utf8'), 2];
|
||||
assert(hasBinary(arr));
|
||||
});
|
||||
|
||||
it('should work with an object that does not contain binary', function() {
|
||||
var ob = {a: 'a', b: [], c: 1234};
|
||||
assert(!hasBinary(ob));
|
||||
});
|
||||
|
||||
it('should work with an object that contains a buffer', function() {
|
||||
var ob = {a: 'a', b: new Buffer('abc'), c: 1234};
|
||||
assert(hasBinary(ob));
|
||||
});
|
||||
|
||||
it('should work with null', function() {
|
||||
assert(!hasBinary(null));
|
||||
});
|
||||
|
||||
it('should work with undefined', function() {
|
||||
assert(!hasBinary(undefined));
|
||||
});
|
||||
|
||||
it('should work with a complex object that contains undefined and no binary', function() {
|
||||
var ob = {
|
||||
x: ['a', 'b', 123],
|
||||
y: undefined,
|
||||
z: {a: 'x', b: 'y', c: 3, d: null},
|
||||
w: []
|
||||
};
|
||||
assert(!hasBinary(ob));
|
||||
});
|
||||
|
||||
it('should work with a complex object that contains undefined and binary', function() {
|
||||
var ob = {
|
||||
x: ['a', 'b', 123],
|
||||
y: undefined,
|
||||
z: {a: 'x', b: 'y', c: 3, d: null},
|
||||
w: [],
|
||||
bin: new Buffer('xxx')
|
||||
};
|
||||
assert(hasBinary(ob));
|
||||
});
|
||||
|
||||
it('should handle a very large json object with no binary', function(done) {
|
||||
this.timeout();
|
||||
fs.readFile(__dirname + '/fixtures/big.json', function(err, data) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
assert(false);
|
||||
}
|
||||
data = JSON.parse(data);
|
||||
assert(!hasBinary(data));
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should handle a very large json object with binary', function(done) {
|
||||
this.timeout();
|
||||
fs.readFile(__dirname + '/fixtures/big.json', function(err, data) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
assert(false);
|
||||
}
|
||||
var ob = JSON.parse(data);
|
||||
ob.bin = {bin: {bin: {bin: new Buffer('abc')}}};
|
||||
assert(hasBinary(ob));
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
if (global.ArrayBuffer) {
|
||||
it('should work with an ArrayBuffer', function() {
|
||||
assert(hasBinary(new ArrayBuffer()));
|
||||
});
|
||||
}
|
||||
|
||||
if (global.Blob) {
|
||||
it('should work with a Blob', function() {
|
||||
assert(hasBinary(new Blob()));
|
||||
});
|
||||
}
|
||||
|
||||
it('should print the test time', function() {
|
||||
var end = new Date();
|
||||
var diff = end - start;
|
||||
console.log('\ntest time: ' + diff + ' ms');
|
||||
});
|
||||
|
||||
});
|
114
node_modules/socket.io-client/node_modules/engine.io-parser/package.json
generated
vendored
Normal file
114
node_modules/socket.io-client/node_modules/engine.io-parser/package.json
generated
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "engine.io-parser@1.3.1",
|
||||
"scope": null,
|
||||
"escapedName": "engine.io-parser",
|
||||
"name": "engine.io-parser",
|
||||
"rawSpec": "1.3.1",
|
||||
"spec": "1.3.1",
|
||||
"type": "version"
|
||||
},
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\socket.io\\node_modules\\engine.io"
|
||||
],
|
||||
[
|
||||
{
|
||||
"raw": "engine.io-parser@1.3.1",
|
||||
"scope": null,
|
||||
"escapedName": "engine.io-parser",
|
||||
"name": "engine.io-parser",
|
||||
"rawSpec": "1.3.1",
|
||||
"spec": "1.3.1",
|
||||
"type": "version"
|
||||
},
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\socket.io-client\\node_modules\\engine.io-client"
|
||||
]
|
||||
],
|
||||
"_from": "engine.io-parser@1.3.1",
|
||||
"_id": "engine.io-parser@1.3.1",
|
||||
"_inCache": true,
|
||||
"_location": "/socket.io-client/engine.io-parser",
|
||||
"_nodeVersion": "4.4.7",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-18-east.internal.npmjs.com",
|
||||
"tmp": "tmp/engine.io-parser-1.3.1.tgz_1476967470566_0.9431107800919563"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "darrachequesne",
|
||||
"email": "damien.arrachequesne@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.15.8",
|
||||
"_phantomChildren": {
|
||||
"isarray": "0.0.1"
|
||||
},
|
||||
"_requested": {
|
||||
"raw": "engine.io-parser@1.3.1",
|
||||
"scope": null,
|
||||
"escapedName": "engine.io-parser",
|
||||
"name": "engine.io-parser",
|
||||
"rawSpec": "1.3.1",
|
||||
"spec": "1.3.1",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/socket.io-client/engine.io-client"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.3.1.tgz",
|
||||
"_shasum": "9554f1ae33107d6fbd170ca5466d2f833f6a07cf",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "engine.io-parser@1.3.1",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\socket.io-client\\node_modules\\engine.io-client",
|
||||
"browser": "./lib/browser.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/socketio/engine.io-parser/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"after": "0.8.1",
|
||||
"arraybuffer.slice": "0.0.6",
|
||||
"base64-arraybuffer": "0.1.5",
|
||||
"blob": "0.0.4",
|
||||
"has-binary": "0.1.6",
|
||||
"wtf-8": "1.0.0"
|
||||
},
|
||||
"description": "Parser for the client for the realtime Engine",
|
||||
"devDependencies": {
|
||||
"expect.js": "0.3.1",
|
||||
"mocha": "2.2.5",
|
||||
"zuul": "3.11.0",
|
||||
"zuul-ngrok": "4.0.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "9554f1ae33107d6fbd170ca5466d2f833f6a07cf",
|
||||
"tarball": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.3.1.tgz"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"lib/"
|
||||
],
|
||||
"gitHead": "ada9dbe77bf345b5284c7a913bead0295b48ed74",
|
||||
"homepage": "https://github.com/socketio/engine.io-parser",
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "darrachequesne",
|
||||
"email": "damien.arrachequesne@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "rauchg",
|
||||
"email": "rauchg@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "engine.io-parser",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/socketio/engine.io-parser.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"version": "1.3.1"
|
||||
}
|
54
node_modules/socket.io-client/node_modules/isarray/README.md
generated
vendored
Normal file
54
node_modules/socket.io-client/node_modules/isarray/README.md
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
# isarray
|
||||
|
||||
`Array#isArray` for older browsers.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var isArray = require('isarray');
|
||||
|
||||
console.log(isArray([])); // => true
|
||||
console.log(isArray({})); // => false
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](http://npmjs.org) do
|
||||
|
||||
```bash
|
||||
$ npm install isarray
|
||||
```
|
||||
|
||||
Then bundle for the browser with
|
||||
[browserify](https://github.com/substack/browserify).
|
||||
|
||||
With [component](http://component.io) do
|
||||
|
||||
```bash
|
||||
$ component install juliangruber/isarray
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
209
node_modules/socket.io-client/node_modules/isarray/build/build.js
generated
vendored
Normal file
209
node_modules/socket.io-client/node_modules/isarray/build/build.js
generated
vendored
Normal file
@ -0,0 +1,209 @@
|
||||
|
||||
/**
|
||||
* Require the given path.
|
||||
*
|
||||
* @param {String} path
|
||||
* @return {Object} exports
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function require(path, parent, orig) {
|
||||
var resolved = require.resolve(path);
|
||||
|
||||
// lookup failed
|
||||
if (null == resolved) {
|
||||
orig = orig || path;
|
||||
parent = parent || 'root';
|
||||
var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
|
||||
err.path = orig;
|
||||
err.parent = parent;
|
||||
err.require = true;
|
||||
throw err;
|
||||
}
|
||||
|
||||
var module = require.modules[resolved];
|
||||
|
||||
// perform real require()
|
||||
// by invoking the module's
|
||||
// registered function
|
||||
if (!module.exports) {
|
||||
module.exports = {};
|
||||
module.client = module.component = true;
|
||||
module.call(this, module.exports, require.relative(resolved), module);
|
||||
}
|
||||
|
||||
return module.exports;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registered modules.
|
||||
*/
|
||||
|
||||
require.modules = {};
|
||||
|
||||
/**
|
||||
* Registered aliases.
|
||||
*/
|
||||
|
||||
require.aliases = {};
|
||||
|
||||
/**
|
||||
* Resolve `path`.
|
||||
*
|
||||
* Lookup:
|
||||
*
|
||||
* - PATH/index.js
|
||||
* - PATH.js
|
||||
* - PATH
|
||||
*
|
||||
* @param {String} path
|
||||
* @return {String} path or null
|
||||
* @api private
|
||||
*/
|
||||
|
||||
require.resolve = function(path) {
|
||||
if (path.charAt(0) === '/') path = path.slice(1);
|
||||
var index = path + '/index.js';
|
||||
|
||||
var paths = [
|
||||
path,
|
||||
path + '.js',
|
||||
path + '.json',
|
||||
path + '/index.js',
|
||||
path + '/index.json'
|
||||
];
|
||||
|
||||
for (var i = 0; i < paths.length; i++) {
|
||||
var path = paths[i];
|
||||
if (require.modules.hasOwnProperty(path)) return path;
|
||||
}
|
||||
|
||||
if (require.aliases.hasOwnProperty(index)) {
|
||||
return require.aliases[index];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Normalize `path` relative to the current path.
|
||||
*
|
||||
* @param {String} curr
|
||||
* @param {String} path
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
require.normalize = function(curr, path) {
|
||||
var segs = [];
|
||||
|
||||
if ('.' != path.charAt(0)) return path;
|
||||
|
||||
curr = curr.split('/');
|
||||
path = path.split('/');
|
||||
|
||||
for (var i = 0; i < path.length; ++i) {
|
||||
if ('..' == path[i]) {
|
||||
curr.pop();
|
||||
} else if ('.' != path[i] && '' != path[i]) {
|
||||
segs.push(path[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return curr.concat(segs).join('/');
|
||||
};
|
||||
|
||||
/**
|
||||
* Register module at `path` with callback `definition`.
|
||||
*
|
||||
* @param {String} path
|
||||
* @param {Function} definition
|
||||
* @api private
|
||||
*/
|
||||
|
||||
require.register = function(path, definition) {
|
||||
require.modules[path] = definition;
|
||||
};
|
||||
|
||||
/**
|
||||
* Alias a module definition.
|
||||
*
|
||||
* @param {String} from
|
||||
* @param {String} to
|
||||
* @api private
|
||||
*/
|
||||
|
||||
require.alias = function(from, to) {
|
||||
if (!require.modules.hasOwnProperty(from)) {
|
||||
throw new Error('Failed to alias "' + from + '", it does not exist');
|
||||
}
|
||||
require.aliases[to] = from;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return a require function relative to the `parent` path.
|
||||
*
|
||||
* @param {String} parent
|
||||
* @return {Function}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
require.relative = function(parent) {
|
||||
var p = require.normalize(parent, '..');
|
||||
|
||||
/**
|
||||
* lastIndexOf helper.
|
||||
*/
|
||||
|
||||
function lastIndexOf(arr, obj) {
|
||||
var i = arr.length;
|
||||
while (i--) {
|
||||
if (arr[i] === obj) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* The relative require() itself.
|
||||
*/
|
||||
|
||||
function localRequire(path) {
|
||||
var resolved = localRequire.resolve(path);
|
||||
return require(resolved, parent, path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve relative to the parent.
|
||||
*/
|
||||
|
||||
localRequire.resolve = function(path) {
|
||||
var c = path.charAt(0);
|
||||
if ('/' == c) return path.slice(1);
|
||||
if ('.' == c) return require.normalize(p, path);
|
||||
|
||||
// resolve deps by returning
|
||||
// the dep in the nearest "deps"
|
||||
// directory
|
||||
var segs = parent.split('/');
|
||||
var i = lastIndexOf(segs, 'deps') + 1;
|
||||
if (!i) i = 0;
|
||||
path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
|
||||
return path;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if module is defined at `path`.
|
||||
*/
|
||||
|
||||
localRequire.exists = function(path) {
|
||||
return require.modules.hasOwnProperty(localRequire.resolve(path));
|
||||
};
|
||||
|
||||
return localRequire;
|
||||
};
|
||||
require.register("isarray/index.js", function(exports, require, module){
|
||||
module.exports = Array.isArray || function (arr) {
|
||||
return Object.prototype.toString.call(arr) == '[object Array]';
|
||||
};
|
||||
|
||||
});
|
||||
require.alias("isarray/index.js", "isarray/index.js");
|
||||
|
19
node_modules/socket.io-client/node_modules/isarray/component.json
generated
vendored
Normal file
19
node_modules/socket.io-client/node_modules/isarray/component.json
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name" : "isarray",
|
||||
"description" : "Array#isArray for older browsers",
|
||||
"version" : "0.0.1",
|
||||
"repository" : "juliangruber/isarray",
|
||||
"homepage": "https://github.com/juliangruber/isarray",
|
||||
"main" : "index.js",
|
||||
"scripts" : [
|
||||
"index.js"
|
||||
],
|
||||
"dependencies" : {},
|
||||
"keywords": ["browser","isarray","array"],
|
||||
"author": {
|
||||
"name": "Julian Gruber",
|
||||
"email": "mail@juliangruber.com",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
3
node_modules/socket.io-client/node_modules/isarray/index.js
generated
vendored
Normal file
3
node_modules/socket.io-client/node_modules/isarray/index.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = Array.isArray || function (arr) {
|
||||
return Object.prototype.toString.call(arr) == '[object Array]';
|
||||
};
|
98
node_modules/socket.io-client/node_modules/isarray/package.json
generated
vendored
Normal file
98
node_modules/socket.io-client/node_modules/isarray/package.json
generated
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "isarray@0.0.1",
|
||||
"scope": null,
|
||||
"escapedName": "isarray",
|
||||
"name": "isarray",
|
||||
"rawSpec": "0.0.1",
|
||||
"spec": "0.0.1",
|
||||
"type": "version"
|
||||
},
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\socket.io\\node_modules\\engine.io-parser\\node_modules\\has-binary"
|
||||
],
|
||||
[
|
||||
{
|
||||
"raw": "isarray@0.0.1",
|
||||
"scope": null,
|
||||
"escapedName": "isarray",
|
||||
"name": "isarray",
|
||||
"rawSpec": "0.0.1",
|
||||
"spec": "0.0.1",
|
||||
"type": "version"
|
||||
},
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\socket.io-client\\node_modules\\engine.io-parser\\node_modules\\has-binary"
|
||||
]
|
||||
],
|
||||
"_from": "isarray@0.0.1",
|
||||
"_id": "isarray@0.0.1",
|
||||
"_inCache": true,
|
||||
"_location": "/socket.io-client/isarray",
|
||||
"_npmUser": {
|
||||
"name": "juliangruber",
|
||||
"email": "julian@juliangruber.com"
|
||||
},
|
||||
"_npmVersion": "1.2.18",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "isarray@0.0.1",
|
||||
"scope": null,
|
||||
"escapedName": "isarray",
|
||||
"name": "isarray",
|
||||
"rawSpec": "0.0.1",
|
||||
"spec": "0.0.1",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/socket.io-client/engine.io-parser/has-binary"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
|
||||
"_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "isarray@0.0.1",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\socket.io-client\\node_modules\\engine.io-parser\\node_modules\\has-binary",
|
||||
"author": {
|
||||
"name": "Julian Gruber",
|
||||
"email": "mail@juliangruber.com",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/juliangruber/isarray/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Array#isArray for older browsers",
|
||||
"devDependencies": {
|
||||
"tap": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf",
|
||||
"tarball": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
|
||||
},
|
||||
"homepage": "https://github.com/juliangruber/isarray",
|
||||
"keywords": [
|
||||
"browser",
|
||||
"isarray",
|
||||
"array"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "juliangruber",
|
||||
"email": "julian@juliangruber.com"
|
||||
}
|
||||
],
|
||||
"name": "isarray",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/juliangruber/isarray.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"version": "0.0.1"
|
||||
}
|
21
node_modules/socket.io-client/node_modules/ms/LICENSE.md
generated
vendored
Normal file
21
node_modules/socket.io-client/node_modules/ms/LICENSE.md
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Zeit, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
52
node_modules/socket.io-client/node_modules/ms/README.md
generated
vendored
Normal file
52
node_modules/socket.io-client/node_modules/ms/README.md
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
# ms
|
||||
|
||||
[](https://travis-ci.org/zeit/ms)
|
||||
[](https://github.com/sindresorhus/xo)
|
||||
[](https://zeit.chat/)
|
||||
|
||||
Use this package to easily convert various time formats to milliseconds.
|
||||
|
||||
## Examples
|
||||
|
||||
```js
|
||||
ms('2 days') // 172800000
|
||||
ms('1d') // 86400000
|
||||
ms('10h') // 36000000
|
||||
ms('2.5 hrs') // 9000000
|
||||
ms('2h') // 7200000
|
||||
ms('1m') // 60000
|
||||
ms('5s') // 5000
|
||||
ms('1y') // 31557600000
|
||||
ms('100') // 100
|
||||
```
|
||||
|
||||
### Convert from milliseconds
|
||||
|
||||
```js
|
||||
ms(60000) // "1m"
|
||||
ms(2 * 60000) // "2m"
|
||||
ms(ms('10 hours')) // "10h"
|
||||
```
|
||||
|
||||
### Time format written-out
|
||||
|
||||
```js
|
||||
ms(60000, { long: true }) // "1 minute"
|
||||
ms(2 * 60000, { long: true }) // "2 minutes"
|
||||
ms(ms('10 hours'), { long: true }) // "10 hours"
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- Works both in [node](https://nodejs.org) and in the browser.
|
||||
- If a number is supplied to `ms`, a string with a unit is returned.
|
||||
- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`).
|
||||
- If you pass a string with a number and a valid unit, the number of equivalent ms is returned.
|
||||
|
||||
## Caught a bug?
|
||||
|
||||
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
|
||||
2. Link the package to the global module directory: `npm link`
|
||||
3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, node will now use your clone of ms!
|
||||
|
||||
As always, you can run the tests using: `npm test`
|
149
node_modules/socket.io-client/node_modules/ms/index.js
generated
vendored
Normal file
149
node_modules/socket.io-client/node_modules/ms/index.js
generated
vendored
Normal file
@ -0,0 +1,149 @@
|
||||
/**
|
||||
* Helpers.
|
||||
*/
|
||||
|
||||
var s = 1000
|
||||
var m = s * 60
|
||||
var h = m * 60
|
||||
var d = h * 24
|
||||
var y = d * 365.25
|
||||
|
||||
/**
|
||||
* Parse or format the given `val`.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `long` verbose formatting [false]
|
||||
*
|
||||
* @param {String|Number} val
|
||||
* @param {Object} options
|
||||
* @throws {Error} throw an error if val is not a non-empty string or a number
|
||||
* @return {String|Number}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function (val, options) {
|
||||
options = options || {}
|
||||
var type = typeof val
|
||||
if (type === 'string' && val.length > 0) {
|
||||
return parse(val)
|
||||
} else if (type === 'number' && isNaN(val) === false) {
|
||||
return options.long ?
|
||||
fmtLong(val) :
|
||||
fmtShort(val)
|
||||
}
|
||||
throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val))
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the given `str` and return milliseconds.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function parse(str) {
|
||||
str = String(str)
|
||||
if (str.length > 10000) {
|
||||
return
|
||||
}
|
||||
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str)
|
||||
if (!match) {
|
||||
return
|
||||
}
|
||||
var n = parseFloat(match[1])
|
||||
var type = (match[2] || 'ms').toLowerCase()
|
||||
switch (type) {
|
||||
case 'years':
|
||||
case 'year':
|
||||
case 'yrs':
|
||||
case 'yr':
|
||||
case 'y':
|
||||
return n * y
|
||||
case 'days':
|
||||
case 'day':
|
||||
case 'd':
|
||||
return n * d
|
||||
case 'hours':
|
||||
case 'hour':
|
||||
case 'hrs':
|
||||
case 'hr':
|
||||
case 'h':
|
||||
return n * h
|
||||
case 'minutes':
|
||||
case 'minute':
|
||||
case 'mins':
|
||||
case 'min':
|
||||
case 'm':
|
||||
return n * m
|
||||
case 'seconds':
|
||||
case 'second':
|
||||
case 'secs':
|
||||
case 'sec':
|
||||
case 's':
|
||||
return n * s
|
||||
case 'milliseconds':
|
||||
case 'millisecond':
|
||||
case 'msecs':
|
||||
case 'msec':
|
||||
case 'ms':
|
||||
return n
|
||||
default:
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Short format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function fmtShort(ms) {
|
||||
if (ms >= d) {
|
||||
return Math.round(ms / d) + 'd'
|
||||
}
|
||||
if (ms >= h) {
|
||||
return Math.round(ms / h) + 'h'
|
||||
}
|
||||
if (ms >= m) {
|
||||
return Math.round(ms / m) + 'm'
|
||||
}
|
||||
if (ms >= s) {
|
||||
return Math.round(ms / s) + 's'
|
||||
}
|
||||
return ms + 'ms'
|
||||
}
|
||||
|
||||
/**
|
||||
* Long format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function fmtLong(ms) {
|
||||
return plural(ms, d, 'day') ||
|
||||
plural(ms, h, 'hour') ||
|
||||
plural(ms, m, 'minute') ||
|
||||
plural(ms, s, 'second') ||
|
||||
ms + ' ms'
|
||||
}
|
||||
|
||||
/**
|
||||
* Pluralization helper.
|
||||
*/
|
||||
|
||||
function plural(ms, n, name) {
|
||||
if (ms < n) {
|
||||
return
|
||||
}
|
||||
if (ms < n * 1.5) {
|
||||
return Math.floor(ms / n) + ' ' + name
|
||||
}
|
||||
return Math.ceil(ms / n) + ' ' + name + 's'
|
||||
}
|
99
node_modules/socket.io-client/node_modules/ms/package.json
generated
vendored
Normal file
99
node_modules/socket.io-client/node_modules/ms/package.json
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"ms@0.7.2",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\socket.io-client\\node_modules\\debug"
|
||||
]
|
||||
],
|
||||
"_from": "ms@0.7.2",
|
||||
"_id": "ms@0.7.2",
|
||||
"_inCache": true,
|
||||
"_location": "/socket.io-client/ms",
|
||||
"_nodeVersion": "6.8.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-18-east.internal.npmjs.com",
|
||||
"tmp": "tmp/ms-0.7.2.tgz_1477383407940_0.4743474116548896"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "leo@zeit.co",
|
||||
"name": "leo"
|
||||
},
|
||||
"_npmVersion": "3.10.8",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "ms",
|
||||
"raw": "ms@0.7.2",
|
||||
"rawSpec": "0.7.2",
|
||||
"scope": null,
|
||||
"spec": "0.7.2",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/socket.io-client/debug"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz",
|
||||
"_shasum": "ae25cf2512b3885a1d95d7f037868d8431124765",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "ms@0.7.2",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\socket.io-client\\node_modules\\debug",
|
||||
"bugs": {
|
||||
"url": "https://github.com/zeit/ms/issues"
|
||||
},
|
||||
"component": {
|
||||
"scripts": {
|
||||
"ms/index.js": "index.js"
|
||||
}
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Tiny milisecond conversion utility",
|
||||
"devDependencies": {
|
||||
"expect.js": "^0.3.1",
|
||||
"mocha": "^3.0.2",
|
||||
"serve": "^1.4.0",
|
||||
"xo": "^0.17.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "ae25cf2512b3885a1d95d7f037868d8431124765",
|
||||
"tarball": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "ac92a7e0790ba2622a74d9d60690ca0d2c070a45",
|
||||
"homepage": "https://github.com/zeit/ms#readme",
|
||||
"installable": true,
|
||||
"license": "MIT",
|
||||
"main": "./index",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "leo",
|
||||
"email": "leo@zeit.co"
|
||||
},
|
||||
{
|
||||
"name": "rauchg",
|
||||
"email": "rauchg@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "ms",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/zeit/ms.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && mocha test/index.js",
|
||||
"test-browser": "serve ./test"
|
||||
},
|
||||
"version": "0.7.2",
|
||||
"xo": {
|
||||
"envs": [
|
||||
"mocha"
|
||||
],
|
||||
"rules": {
|
||||
"complexity": 0
|
||||
},
|
||||
"semicolon": false,
|
||||
"space": true
|
||||
}
|
||||
}
|
149
node_modules/socket.io-client/package.json
generated
vendored
Normal file
149
node_modules/socket.io-client/package.json
generated
vendored
Normal file
@ -0,0 +1,149 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"socket.io-client@1.6.0",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\browser-sync"
|
||||
]
|
||||
],
|
||||
"_from": "socket.io-client@1.6.0",
|
||||
"_id": "socket.io-client@1.6.0",
|
||||
"_inCache": true,
|
||||
"_location": "/socket.io-client",
|
||||
"_nodeVersion": "4.4.7",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-18-east.internal.npmjs.com",
|
||||
"tmp": "tmp/socket.io-client-1.6.0.tgz_1479612376581_0.33392561320215464"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "damien.arrachequesne@gmail.com",
|
||||
"name": "darrachequesne"
|
||||
},
|
||||
"_npmVersion": "2.15.8",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "socket.io-client",
|
||||
"raw": "socket.io-client@1.6.0",
|
||||
"rawSpec": "1.6.0",
|
||||
"scope": null,
|
||||
"spec": "1.6.0",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/browser-sync",
|
||||
"/socket.io"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-1.6.0.tgz",
|
||||
"_shasum": "5b668f4f771304dfeed179064708386fa6717853",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "socket.io-client@1.6.0",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\browser-sync",
|
||||
"bugs": {
|
||||
"url": "https://github.com/Automattic/socket.io-client/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Guillermo Rauch",
|
||||
"email": "rauchg@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Arnout Kazemier",
|
||||
"email": "info@3rd-eden.com"
|
||||
},
|
||||
{
|
||||
"name": "Vladimir Dronnikov",
|
||||
"email": "dronnikov@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Einar Otto Stangvik",
|
||||
"email": "einaros@gmail.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"backo2": "1.0.2",
|
||||
"component-bind": "1.0.0",
|
||||
"component-emitter": "1.2.1",
|
||||
"debug": "2.3.3",
|
||||
"engine.io-client": "1.8.0",
|
||||
"has-binary": "0.1.7",
|
||||
"indexof": "0.0.1",
|
||||
"object-component": "0.0.3",
|
||||
"parseuri": "0.0.5",
|
||||
"socket.io-parser": "2.3.1",
|
||||
"to-array": "0.1.4"
|
||||
},
|
||||
"description": "[](http://travis-ci.org/socketio/socket.io-client) [](https://david-dm.org/socketio/socket.io-",
|
||||
"devDependencies": {
|
||||
"babel-core": "6.4.5",
|
||||
"babel-eslint": "4.1.7",
|
||||
"babel-loader": "6.2.1",
|
||||
"babel-preset-es2015": "6.3.13",
|
||||
"base64-arraybuffer": "0.1.5",
|
||||
"concat-stream": "1.5.1",
|
||||
"derequire": "2.0.3",
|
||||
"eslint-config-standard": "4.4.0",
|
||||
"eslint-plugin-standard": "1.3.1",
|
||||
"expect.js": "0.3.1",
|
||||
"gulp": "3.9.0",
|
||||
"gulp-eslint": "1.1.1",
|
||||
"gulp-file": "0.2.0",
|
||||
"gulp-istanbul": "0.10.3",
|
||||
"gulp-minify": "0.0.14",
|
||||
"gulp-mocha": "2.2.0",
|
||||
"gulp-task-listing": "1.0.1",
|
||||
"has-cors": "1.1.0",
|
||||
"imports-loader": "^0.6.5",
|
||||
"istanbul": "0.4.2",
|
||||
"mocha": "2.3.4",
|
||||
"socket.io": "1.6.0",
|
||||
"text-blob-builder": "0.0.1",
|
||||
"uglify-js": "2.6.1",
|
||||
"webpack-stream": "3.1.0",
|
||||
"zuul": "3.11.0",
|
||||
"zuul-builder-webpack": "1.1.0",
|
||||
"zuul-ngrok": "4.0.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "5b668f4f771304dfeed179064708386fa6717853",
|
||||
"tarball": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-1.6.0.tgz"
|
||||
},
|
||||
"files": [
|
||||
"lib/",
|
||||
"socket.io.js",
|
||||
"socket.io.js.map",
|
||||
"socket.io.min.js"
|
||||
],
|
||||
"gitHead": "fa14f91dd8a297f759644f0673185057170efa41",
|
||||
"homepage": "https://github.com/Automattic/socket.io-client#readme",
|
||||
"installable": true,
|
||||
"keywords": [
|
||||
"client",
|
||||
"events",
|
||||
"framework",
|
||||
"realtime",
|
||||
"tcp",
|
||||
"websocket"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/index",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "darrachequesne",
|
||||
"email": "damien.arrachequesne@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "rauchg",
|
||||
"email": "rauchg@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "socket.io-client",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Automattic/socket.io-client.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "gulp test"
|
||||
},
|
||||
"version": "1.6.0"
|
||||
}
|
8284
node_modules/socket.io-client/socket.io.js
generated
vendored
Normal file
8284
node_modules/socket.io-client/socket.io.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/socket.io-client/socket.io.js.map
generated
vendored
Normal file
1
node_modules/socket.io-client/socket.io.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/socket.io-client/socket.io.min.js
generated
vendored
Normal file
3
node_modules/socket.io-client/socket.io.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user