aboutsummaryrefslogtreecommitdiffstats
path: root/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
diff options
context:
space:
mode:
Diffstat (limited to 'signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws')
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/.npmignore11
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/.travis.yml5
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/History.md312
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/Makefile40
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/README.md171
-rwxr-xr-xsignaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/bin/wscat222
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/binding.gyp16
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Makefile337
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/bufferutil.node.d1
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/obj.target/bufferutil.node.d1
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d29
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/obj.target/validation.node.d1
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/obj.target/validation/src/validation.o.d29
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/validation.node.d1
-rwxr-xr-xsignaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/bufferutil.nodebin0 -> 21320 bytes
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/linker.lock0
-rwxr-xr-xsignaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/obj.target/bufferutil.nodebin0 -> 21320 bytes
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/obj.target/bufferutil/src/bufferutil.obin0 -> 19792 bytes
-rwxr-xr-xsignaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/obj.target/validation.nodebin0 -> 21252 bytes
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/obj.target/validation/src/validation.obin0 -> 17552 bytes
-rwxr-xr-xsignaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/validation.nodebin0 -> 21252 bytes
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/binding.Makefile6
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/bufferutil.target.mk133
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/config.gypi122
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/validation.target.mk133
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/builderror.log0
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/index.js26
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferPool.js59
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferUtil.fallback.js47
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferUtil.js16
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/ErrorCodes.js24
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Receiver.hixie.js180
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Receiver.js585
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Sender.hixie.js118
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Sender.js227
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Validation.fallback.js12
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Validation.js16
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/WebSocket.js794
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/WebSocketServer.js465
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/browser.js43
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/Readme.md195
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/index.js851
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/package.json57
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/.dntrc36
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/LICENSE46
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/README.md947
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/build/config.gypi38
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/include_dirs.js1
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/nan.h1910
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/package.json67
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/.npmignore7
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/Makefile12
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/README.md69
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/lib/options.js86
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/package.json50
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/.npmignore5
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/README.md3
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/example.js3
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/package.json43
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/tinycolor.js31
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/package.json81
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/src/bufferutil.cc117
-rw-r--r--signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/src/validation.cc145
63 files changed, 8982 insertions, 0 deletions
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/.npmignore b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/.npmignore
new file mode 100644
index 0000000..1eba800
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/.npmignore
@@ -0,0 +1,11 @@
+npm-debug.log
+node_modules
+.*.swp
+.lock-*
+build
+
+bench
+doc
+examples
+test
+
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/.travis.yml b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/.travis.yml
new file mode 100644
index 0000000..9735866
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/.travis.yml
@@ -0,0 +1,5 @@
+language: node_js
+npm_args: --ws:native
+node_js:
+ - "0.8"
+ - "0.10"
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/History.md b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/History.md
new file mode 100644
index 0000000..63cf0ea
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/History.md
@@ -0,0 +1,312 @@
+v0.4.31 - September 23th, 2013
+=====================
+
+* Component support
+
+v0.4.30 - August 30th, 2013
+=====================
+
+* BufferedAmount could be undefined, default to 0 [TooTallNate]
+* Support protocols as second argument and options as third [TooTallNate]
+* Proper browserify shim [mcollina]
+* Broadcasting example in README [stefanocudini]
+
+v0.4.29 - August 23th, 2013
+=====================
+* Small clean up of the Node 0.11 support by using NAN from the NPM registry [kkoopa]
+* Support for custom `Agent`'s through the options. [gramakri] & [TooTallNate]
+* Support for custom headers through the options [3rd-Eden]
+* Added a `gypfile` flag to the package.json for compiled module discovery [wolfeidau]
+
+v0.4.28 - August 16th, 2013
+=====================
+* Node 0.11 support. [kkoopa]
+* Authorization headers are sent when basic auth is used in the url [jcrugzz]
+* Origin header will now include the port number [Jason Plum]
+* Race condition fixed where data was received before the readyState was updated. [saschagehlich]
+
+v0.4.27 - June 27th, 2013
+=====================
+* Frames are no longer masked in `wscat`. [slaskis]
+* Don't retrain reference to large slab buffers. [jmatthewsr-msi]
+* Don't use Buffer.byteLength for ArrayBuffer's. [Anthony Pesch]
+* Fix browser field in package.json. [shtylman]
+* Client-side certificate support & documentation improvements. [Lukas Berns]
+* WebSocket readyState's is added to the prototype for spec compatiblity. [BallBearing]
+* Use Object.defineProperty. [arlolra]
+* Autodetect ArrayBuffers as binary when sending. [BallBearing]
+* Check instanceof Buffer for binary data. [arlolra]
+* Emit the close event before destroying the internal socket. [3rd-Eden]
+* Don't setup multiply timeouts for one connection. [AndreasMadsen]
+* Allow support for binding to ethereal port. [wpreul]
+* Fix broken terminate reference. [3rd-Eden]
+* Misc node 0.10 test fixes and documentation improvements. [3rd-Eden]
+* Ensure ssl options are propagated to request. [einaros]
+* Add 'Host' and 'Origin' to request header. [Lars-Magnus Skog]
+* Subprotocol support. [kanaka]
+* Honor ArrayBufferView's byteOffset when sending. [Anthony Pesch]
+* Added target attribute for events. [arlolra]
+
+v0.4.26 - Skipped
+=====================
+
+v0.4.25 - December 17th, 2012
+=====================
+* Removed install.js. [shtylman]
+* Added browser field to package.json. [shtylman]
+* Support overwriting host header. [Raynos]
+* Emit 'listening' also with custom http server. [sebiq]
+
+v0.4.24 - December 6th, 2012
+=====================
+* Yet another intermediate release, to not delay minor features any longer.
+* Native support installation issues further circumvented. [einaros]
+
+v0.4.23 - November 19th, 2012
+=====================
+* Service release - last before major upgrade.
+* Changes default host from 127.0.0.1 to 0.0.0.0. [einaros]
+
+v0.4.22 - October 3rd, 2012
+=====================
+* clear failsafe cleanup timeout once cleanup is called [AndreasMadsen]
+* added w3c compatible CloseEvent for onclose / addEventListener("close", ...). [einaros]
+* fix the sub protocol header handler [sonnyp]
+* fix unhandled exception if socket closes and 'error' is emitted [jmatthewsr-ms]
+
+v0.4.21 - July 14th, 2012
+=====================
+* Emit error if server reponds with anything other than status code 101. [einaros]
+* Added 'headers' event to server. [rauchg]
+* path.exists moved to fs.exists. [blakmatrix]
+
+v0.4.20 - June 26th, 2012
+=====================
+* node v0.8.0 compatibility release.
+
+v0.4.19 - June 19th, 2012
+=====================
+* Change sender to merge buffers for relatively small payloads, may improve perf in some cases [einaros]
+* Avoid EventEmitter for Receiver classes. As above this may improve perf. [einaros]
+* Renamed fallback files from the somewhat misleading '*Windows'. [einaros]
+
+v0.4.18 - June 14th 2012
+=====================
+* Fixed incorrect md5 digest encoding in Hixie handshake [nicokaiser]
+* Added example of use with Express 3 [einaros]
+* Change installation procedure to not require --ws:native to build native extensions. They will now build if a compiler is available. [einaros]
+
+v0.4.17 - June 13th 2012
+=====================
+* Improve error handling during connection handshaking [einaros]
+* Ensure that errors are caught also after connection teardown [nicokaiser]
+* Update 'mocha' version to 1.1.0. [einaros]
+* Stop showing 'undefined' for some error logs. [tricknotes]
+* Update 'should' version to 0.6.3 [tricknotes]
+
+v0.4.16 - June 1st 2012
+=====================
+* Build fix for Windows. [einaros]
+
+v0.4.15 - May 20th 2012
+=====================
+* Enable fauxe streaming for hixie tansport. [einaros]
+* Allow hixie sender to deal with buffers. [einaros/pigne]
+* Allow error code 1011. [einaros]
+* Fix framing for empty packets (empty pings and pongs might break). [einaros]
+* Improve error and close handling, to avoid connections lingering in CLOSING state. [einaros]
+
+v0.4.14 - Apr 30th 2012
+=====================
+* use node-gyp instead of node-waf [TooTallNate]
+* remove old windows compatibility makefile, and silently fall back to native modules [einaros]
+* ensure connection status [nicokaiser]
+* websocket client updated to use port 443 by default for wss:// connections [einaros]
+* support unix sockets [kschzt]
+
+v0.4.13 - Apr 12th 2012
+=====================
+
+* circumvent node 0.6+ related memory leak caused by Object.defineProperty [nicokaiser]
+* improved error handling, improving stability in massive load use cases [nicokaiser]
+
+v0.4.12 - Mar 30th 2012
+=====================
+
+* various memory leak / possible memory leak cleanups [einaros]
+* api documentation [nicokaiser]
+* add option to disable client tracking [nicokaiser]
+
+v0.4.11 - Mar 24th 2012
+=====================
+
+* node v0.7 compatibillity release
+* gyp support [TooTallNate]
+* commander dependency update [jwueller]
+* loadbalancer support [nicokaiser]
+
+v0.4.10 - Mar 22th 2012
+=====================
+
+* Final hixie close frame fixes. [nicokaiser]
+
+v0.4.9 - Mar 21st 2012
+=====================
+
+* Various hixie bugfixes (such as proper close frame handling). [einaros]
+
+v0.4.8 - Feb 29th 2012
+=====================
+
+* Allow verifyClient to run asynchronously [karlsequin]
+* Various bugfixes and cleanups. [einaros]
+
+v0.4.7 - Feb 21st 2012
+=====================
+
+* Exposed bytesReceived from websocket client object, which makes it possible to implement bandwidth sampling. [einaros]
+* Updated browser based file upload example to include and output per websocket channel bandwidth sampling. [einaros]
+* Changed build scripts to check which architecture is currently in use. Required after the node.js changes to have prebuilt packages target ia32 by default. [einaros]
+
+v0.4.6 - Feb 9th 2012
+=====================
+
+* Added browser based file upload example. [einaros]
+* Added server-to-browser status push example. [einaros]
+* Exposed pause() and resume() on WebSocket object, to enable client stream shaping. [einaros]
+
+v0.4.5 - Feb 7th 2012
+=====================
+
+* Corrected regression bug in handling of connections with the initial frame delivered across both http upgrade head and a standalone packet. This would lead to a race condition, which in some cases could cause message corruption. [einaros]
+
+v0.4.4 - Feb 6th 2012
+=====================
+
+* Pass original request object to verifyClient, for cookie or authentication verifications. [einaros]
+* Implemented addEventListener and slightly improved the emulation API by adding a MessageEvent with a readonly data attribute. [aslakhellesoy]
+* Rewrite parts of hybi receiver to avoid stack overflows for large amounts of packets bundled in the same buffer / packet. [einaros]
+
+v0.4.3 - Feb 4th 2012
+=====================
+
+* Prioritized update: Corrected issue which would cause sockets to stay open longer than necessary, and resource leakage because of this. [einaros]
+
+v0.4.2 - Feb 4th 2012
+=====================
+
+* Breaking change: WebSocketServer's verifyOrigin option has been renamed to verifyClient. [einaros]
+* verifyClient now receives { origin: 'origin header', secure: true/false }, where 'secure' will be true for ssl connections. [einaros]
+* Split benchmark, in preparation for more thorough case. [einaros]
+* Introduced hixie-76 draft support for server, since Safari (iPhone / iPad / OS X) and Opera still aren't updated to use Hybi. [einaros]
+* Expose 'supports' object from WebSocket, to indicate e.g. the underlying transport's support for binary data. [einaros]
+* Test and code cleanups. [einaros]
+
+v0.4.1 - Jan 25th 2012
+=====================
+
+* Use readline in wscat [tricknotes]
+* Refactor _state away, in favor of the new _readyState [tricknotes]
+* travis-ci integration [einaros]
+* Fixed race condition in testsuite, causing a few tests to fail (without actually indicating errors) on travis [einaros]
+* Expose pong event [paddybyers]
+* Enabled running of WebSocketServer in noServer-mode, meaning that upgrades are passed in manually. [einaros]
+* Reworked connection procedure for WebSocketServer, and cleaned up tests. [einaros]
+
+v0.4.0 - Jan 2nd 2012
+=====================
+
+* Windows compatibility [einaros]
+* Windows compatible test script [einaros]
+
+v0.3.9 - Jan 1st 2012
+======================
+
+* Improved protocol framing performance [einaros]
+* WSS support [kazuyukitanimura]
+* WSS tests [einaros]
+* readyState exposed [justinlatimer, tricknotes]
+* url property exposed [justinlatimer]
+* Removed old 'state' property [einaros]
+* Test cleanups [einaros]
+
+v0.3.8 - Dec 27th 2011
+======================
+
+* Made it possible to listen on specific paths, which is especially good to have for precreated http servers [einaros]
+* Extensive WebSocket / WebSocketServer cleanup, including changing all internal properties to unconfigurable, unenumerable properties [einaros]
+* Receiver modifications to ensure even better performance with fragmented sends [einaros]
+* Fixed issue in sender.js, which would cause SlowBuffer instances (such as returned from the crypto library's randomBytes) to be copied (and thus be dead slow) [einaros]
+* Removed redundant buffer copy in sender.js, which should improve server performance [einaros]
+
+v0.3.7 - Dec 25nd 2011
+======================
+
+* Added a browser based API which uses EventEmitters internally [3rd-Eden]
+* Expose request information from upgrade event for websocket server clients [mmalecki]
+
+v0.3.6 - Dec 19th 2011
+======================
+
+* Added option to let WebSocket.Server use an already existing http server [mmalecki]
+* Migrating various option structures to use options.js module [einaros]
+* Added a few more tests, options and handshake verifications to ensure that faulty connections are dealt with [einaros]
+* Code cleanups in Sender and Receiver, to ensure even faster parsing [einaros]
+
+v0.3.5 - Dec 13th 2011
+======================
+
+* Optimized Sender.js, Receiver.js and bufferutil.cc:
+ * Apply loop-unrolling-like small block copies rather than use node.js Buffer#copy() (which is slow).
+ * Mask blocks of data using combination of 32bit xor and loop-unrolling, instead of single bytes.
+ * Keep pre-made send buffer for small transfers.
+* Leak fixes and code cleanups.
+
+v0.3.3 - Dec 12th 2011
+======================
+
+* Compile fix for Linux.
+* Rewrote parts of WebSocket.js, to avoid try/catch and thus avoid optimizer bailouts.
+
+v0.3.2 - Dec 11th 2011
+======================
+
+* Further performance updates, including the additions of a native BufferUtil module, which deals with several of the cpu intensive WebSocket operations.
+
+v0.3.1 - Dec 8th 2011
+======================
+
+* Service release, fixing broken tests.
+
+v0.3.0 - Dec 8th 2011
+======================
+
+* Node.js v0.4.x compatibility.
+* Code cleanups and efficiency improvements.
+* WebSocket server added, although this will still mainly be a client library.
+* WebSocket server certified to pass the Autobahn test suite.
+* Protocol improvements and corrections - such as handling (redundant) masks for empty fragments.
+* 'wscat' command line utility added, which can act as either client or server.
+
+v0.2.6 - Dec 3rd 2011
+======================
+
+* Renamed to 'ws'. Big woop, right -- but easy-websocket really just doesn't cut it anymore!
+
+v0.2.5 - Dec 3rd 2011
+======================
+
+ * Rewrote much of the WebSocket parser, to ensure high speed for highly fragmented messages.
+ * Added a BufferPool, as a start to more efficiently deal with allocations for WebSocket connections. More work to come, in that area.
+ * Updated the Autobahn report, at http://einaros.github.com/easy-websocket, with comparisons against WebSocket-Node 1.0.2 and Chrome 16.
+
+v0.2.0 - Nov 25th 2011
+======================
+
+ * Major rework to make sure all the Autobahn test cases pass. Also updated the internal tests to cover more corner cases.
+
+v0.1.2 - Nov 14th 2011
+======================
+
+ * Back and forth, back and forth: now settled on keeping the api (event names, methods) closer to the websocket browser api. This will stick now.
+ * Started keeping this history record. Better late than never, right?
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/Makefile b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/Makefile
new file mode 100644
index 0000000..151aa2b
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/Makefile
@@ -0,0 +1,40 @@
+ALL_TESTS = $(shell find test/ -name '*.test.js')
+ALL_INTEGRATION = $(shell find test/ -name '*.integration.js')
+
+all:
+ node-gyp configure build
+
+clean:
+ node-gyp clean
+
+run-tests:
+ @./node_modules/.bin/mocha \
+ -t 2000 \
+ -s 2400 \
+ $(TESTFLAGS) \
+ $(TESTS)
+
+run-integrationtests:
+ @./node_modules/.bin/mocha \
+ -t 5000 \
+ -s 6000 \
+ $(TESTFLAGS) \
+ $(TESTS)
+
+test:
+ @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests
+
+integrationtest:
+ @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_INTEGRATION)" run-integrationtests
+
+benchmark:
+ @node bench/sender.benchmark.js
+ @node bench/parser.benchmark.js
+
+autobahn:
+ @NODE_PATH=lib node test/autobahn.js
+
+autobahn-server:
+ @NODE_PATH=lib node test/autobahn-server.js
+
+.PHONY: test
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/README.md b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/README.md
new file mode 100644
index 0000000..cf1f1fb
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/README.md
@@ -0,0 +1,171 @@
+[![Build Status](https://secure.travis-ci.org/einaros/ws.png)](http://travis-ci.org/einaros/ws)
+
+# ws: a node.js websocket library #
+
+`ws` is a simple to use websocket implementation, up-to-date against RFC-6455, and [probably the fastest WebSocket library for node.js](http://web.archive.org/web/20130314230536/http://hobbycoding.posterous.com/the-fastest-websocket-module-for-nodejs).
+
+Passes the quite extensive Autobahn test suite. See http://einaros.github.com/ws for the full reports.
+
+Comes with a command line utility, `wscat`, which can either act as a server (--listen), or client (--connect); Use it to debug simple websocket services.
+
+## Protocol support ##
+
+* **Hixie draft 76** (Old and deprecated, but still in use by Safari and Opera. Added to ws version 0.4.2, but server only. Can be disabled by setting the `disableHixie` option to true.)
+* **HyBi drafts 07-12** (Use the option `protocolVersion: 8`, or argument `-p 8` for wscat)
+* **HyBi drafts 13-17** (Current default, alternatively option `protocolVersion: 13`, or argument `-p 13` for wscat)
+
+_See the echo.websocket.org example below for how to use the `protocolVersion` option._
+
+## Usage ##
+
+### Installing ###
+
+`npm install ws`
+
+### Sending and receiving text data ###
+
+```js
+var WebSocket = require('ws');
+var ws = new WebSocket('ws://www.host.com/path');
+ws.on('open', function() {
+ ws.send('something');
+});
+ws.on('message', function(data, flags) {
+ // flags.binary will be set if a binary data is received
+ // flags.masked will be set if the data was masked
+});
+```
+
+### Sending binary data ###
+
+```js
+var WebSocket = require('ws');
+var ws = new WebSocket('ws://www.host.com/path');
+ws.on('open', function() {
+ var array = new Float32Array(5);
+ for (var i = 0; i < array.length; ++i) array[i] = i / 2;
+ ws.send(array, {binary: true, mask: true});
+});
+```
+
+Setting `mask`, as done for the send options above, will cause the data to be masked according to the websocket protocol. The same option applies for text data.
+
+### Server example ###
+
+```js
+var WebSocketServer = require('ws').Server
+ , wss = new WebSocketServer({port: 8080});
+wss.on('connection', function(ws) {
+ ws.on('message', function(message) {
+ console.log('received: %s', message);
+ });
+ ws.send('something');
+});
+```
+
+### Server sending broadcast data ###
+
+```js
+var WebSocketServer = require('ws').Server
+ , wss = new WebSocketServer({port: 8080});
+
+wss.broadcast = function(data) {
+ for(var i in this.clients)
+ this.clients[i].send(data);
+};
+```
+
+### Error handling best practices ###
+
+```js
+// If the WebSocket is closed before the following send is attempted
+ws.send('something');
+
+// Errors (both immediate and async write errors) can be detected in an optional callback.
+// The callback is also the only way of being notified that data has actually been sent.
+ws.send('something', function(error) {
+ // if error is null, the send has been completed,
+ // otherwise the error object will indicate what failed.
+});
+
+// Immediate errors can also be handled with try/catch-blocks, but **note**
+// that since sends are inherently asynchronous, socket write failures will *not*
+// be captured when this technique is used.
+try {
+ ws.send('something');
+}
+catch (e) {
+ // handle error
+}
+```
+
+### echo.websocket.org demo ###
+
+```js
+var WebSocket = require('ws');
+var ws = new WebSocket('ws://echo.websocket.org/', {protocolVersion: 8, origin: 'http://websocket.org'});
+ws.on('open', function() {
+ console.log('connected');
+ ws.send(Date.now().toString(), {mask: true});
+});
+ws.on('close', function() {
+ console.log('disconnected');
+});
+ws.on('message', function(data, flags) {
+ console.log('Roundtrip time: ' + (Date.now() - parseInt(data)) + 'ms', flags);
+ setTimeout(function() {
+ ws.send(Date.now().toString(), {mask: true});
+ }, 500);
+});
+```
+
+### wscat against echo.websocket.org ###
+
+ $ npm install -g ws
+ $ wscat -c ws://echo.websocket.org
+ connected (press CTRL+C to quit)
+ > hi there
+ < hi there
+ > are you a happy parrot?
+ < are you a happy parrot?
+
+### Other examples ###
+
+For a full example with a browser client communicating with a ws server, see the examples folder.
+
+Note that the usage together with Express 3.0 is quite different from Express 2.x. The difference is expressed in the two different serverstats-examples.
+
+Otherwise, see the test cases.
+
+### Running the tests ###
+
+`make test`
+
+## API Docs ##
+
+See the doc/ directory for Node.js-like docs for the ws classes.
+
+## License ##
+
+(The MIT License)
+
+Copyright (c) 2011 Einar Otto Stangvik &lt;einaros@gmail.com&gt;
+
+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.
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/bin/wscat b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/bin/wscat
new file mode 100755
index 0000000..7c66600
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/bin/wscat
@@ -0,0 +1,222 @@
+#!/usr/bin/env node
+
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var WebSocket = require('../')
+ , fs = require('fs')
+ , program = require('commander')
+ , util = require('util')
+ , events = require('events')
+ , readline = require('readline');
+
+/**
+ * InputReader - processes console input
+ */
+
+function Console() {
+ this.stdin = process.stdin;
+ this.stdout = process.stdout;
+
+ this.readlineInterface = readline.createInterface(this.stdin, this.stdout);
+
+ var self = this;
+ this.readlineInterface.on('line', function(data) {
+ self.emit('line', data);
+ });
+ this.readlineInterface.on('close', function() {
+ self.emit('close');
+ });
+
+ this._resetInput = function() {
+ self.clear();
+ }
+}
+util.inherits(Console, events.EventEmitter);
+
+Console.Colors = {
+ Red: '\033[31m',
+ Green: '\033[32m',
+ Yellow: '\033[33m',
+ Blue: '\033[34m',
+ Default: '\033[39m'
+};
+
+Console.prototype.prompt = function() {
+ this.readlineInterface.prompt();
+}
+
+Console.prototype.print = function(msg, color) {
+ this.clear();
+ color = color || Console.Colors.Default;
+ this.stdout.write(color + msg + Console.Colors.Default + '\n');
+ this.prompt();
+}
+
+Console.prototype.clear = function() {
+ this.stdout.write('\033[2K\033[E');
+}
+
+Console.prototype.pause = function() {
+ this.stdin.on('keypress', this._resetInput);
+}
+
+Console.prototype.resume = function() {
+ this.stdin.removeListener('keypress', this._resetInput);
+}
+
+function appender(xs) {
+ xs = xs || [];
+ return function (x) {
+ xs.push(x);
+ return xs;
+ }
+}
+
+function into(obj, kvals) {
+ kvals.forEach(function (kv) {
+ obj[kv[0]] = kv[1];
+ });
+ return obj;
+}
+
+function splitOnce(sep, str) { // sep can be either String or RegExp
+ var tokens = str.split(sep);
+ return [tokens[0], str.replace(sep, '').substr(tokens[0].length)];
+}
+
+/**
+ * The actual application
+ */
+
+var version = JSON.parse(fs.readFileSync(__dirname + '/../package.json', 'utf8')).version;
+program
+ .version(version)
+ .usage('[options] <url>')
+ .option('-l, --listen <port>', 'listen on port')
+ .option('-c, --connect <url>', 'connect to a websocket server')
+ .option('-p, --protocol <version>', 'optional protocol version')
+ .option('-o, --origin <origin>', 'optional origin')
+ .option('--host <host>', 'optional host')
+ .option('-s, --subprotocol <protocol>', 'optional subprotocol')
+ .option('-n, --no-check', 'Do not check for unauthorized certificates')
+ .option('-H, --header <header:value>', 'Set an HTTP header. Repeat to set multiple. (--connect only)', appender(), [])
+ .option('--auth <username:password>', 'Add basic HTTP authentication header. (--connect only)')
+ .parse(process.argv);
+
+if (program.listen && program.connect) {
+ console.error('\033[33merror: use either --listen or --connect\033[39m');
+ process.exit(-1);
+}
+else if (program.listen) {
+ var wsConsole = new Console();
+ wsConsole.pause();
+ var options = {};
+ if (program.protocol) options.protocolVersion = program.protocol;
+ if (program.origin) options.origin = program.origin;
+ if (program.subprotocol) options.protocol = program.subprotocol;
+ if (!program.check) options.rejectUnauthorized = program.check;
+ var ws = null;
+ var wss = new WebSocket.Server({port: program.listen}, function() {
+ wsConsole.print('listening on port ' + program.listen + ' (press CTRL+C to quit)', Console.Colors.Green);
+ wsConsole.clear();
+ });
+ wsConsole.on('close', function() {
+ if (ws) {
+ try {
+ ws.close();
+ }
+ catch (e) {}
+ }
+ process.exit(0);
+ });
+ wsConsole.on('line', function(data) {
+ if (ws) {
+ ws.send(data, {mask: false});
+ wsConsole.prompt();
+ }
+ });
+ wss.on('connection', function(newClient) {
+ if (ws) {
+ // limit to one client
+ newClient.terminate();
+ return;
+ };
+ ws = newClient;
+ wsConsole.resume();
+ wsConsole.prompt();
+ wsConsole.print('client connected', Console.Colors.Green);
+ ws.on('close', function() {
+ wsConsole.print('disconnected', Console.Colors.Green);
+ wsConsole.clear();
+ wsConsole.pause();
+ ws = null;
+ });
+ ws.on('error', function(code, description) {
+ wsConsole.print('error: ' + code + (description ? ' ' + description : ''), Console.Colors.Yellow);
+ });
+ ws.on('message', function(data, flags) {
+ wsConsole.print('< ' + data, Console.Colors.Blue);
+ });
+ });
+ wss.on('error', function(error) {
+ wsConsole.print('error: ' + error.toString(), Console.Colors.Yellow);
+ process.exit(-1);
+ });
+}
+else if (program.connect) {
+ var wsConsole = new Console();
+ var options = {};
+ if (program.protocol) options.protocolVersion = program.protocol;
+ if (program.origin) options.origin = program.origin;
+ if (program.subprotocol) options.protocol = program.subprotocol;
+ if (program.host) options.host = program.host;
+ if (!program.check) options.rejectUnauthorized = program.check;
+ var headers = into({}, (program.header || []).map(function (s) {
+ return splitOnce(':', s)
+ }));
+ if (program.auth) {
+ headers['Authorization'] = 'Basic ' + new Buffer(program.auth).toString('base64');
+ }
+ options.headers = headers;
+ var ws = new WebSocket(program.connect, options);
+ ws.on('open', function() {
+ wsConsole.print('connected (press CTRL+C to quit)', Console.Colors.Green);
+ wsConsole.on('line', function(data) {
+ ws.send(data, {mask: true});
+ wsConsole.prompt();
+ });
+ });
+ ws.on('close', function() {
+ wsConsole.print('disconnected', Console.Colors.Green);
+ wsConsole.clear();
+ process.exit();
+ });
+ ws.on('error', function(code, description) {
+ wsConsole.print('error: ' + code + (description ? ' ' + description : ''), Console.Colors.Yellow);
+ process.exit(-1);
+ });
+ ws.on('message', function(data, flags) {
+ wsConsole.print('< ' + data, Console.Colors.Blue);
+ });
+ wsConsole.on('close', function() {
+ if (ws) {
+ try {
+ ws.close();
+ }
+ catch(e) {}
+ process.exit();
+ }
+ });
+}
+else {
+ console.error('\033[33merror: use either --listen or --connect\033[39m');
+ process.exit(-1);
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/binding.gyp b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/binding.gyp
new file mode 100644
index 0000000..600f9d1
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/binding.gyp
@@ -0,0 +1,16 @@
+{
+ 'targets': [
+ {
+ 'target_name': 'validation',
+ 'include_dirs': ["<!(node -e \"require('nan')\")"],
+ 'cflags': [ '-O3' ],
+ 'sources': [ 'src/validation.cc' ]
+ },
+ {
+ 'target_name': 'bufferutil',
+ 'include_dirs': ["<!(node -e \"require('nan')\")"],
+ 'cflags': [ '-O3' ],
+ 'sources': [ 'src/bufferutil.cc' ]
+ }
+ ]
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Makefile b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Makefile
new file mode 100644
index 0000000..8bd48bd
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Makefile
@@ -0,0 +1,337 @@
+# We borrow heavily from the kernel build setup, though we are simpler since
+# we don't have Kconfig tweaking settings on us.
+
+# The implicit make rules have it looking for RCS files, among other things.
+# We instead explicitly write all the rules we care about.
+# It's even quicker (saves ~200ms) to pass -r on the command line.
+MAKEFLAGS=-r
+
+# The source directory tree.
+srcdir := ..
+abs_srcdir := $(abspath $(srcdir))
+
+# The name of the builddir.
+builddir_name ?= .
+
+# The V=1 flag on command line makes us verbosely print command lines.
+ifdef V
+ quiet=
+else
+ quiet=quiet_
+endif
+
+# Specify BUILDTYPE=Release on the command line for a release build.
+BUILDTYPE ?= Release
+
+# Directory all our build output goes into.
+# Note that this must be two directories beneath src/ for unit tests to pass,
+# as they reach into the src/ directory for data with relative paths.
+builddir ?= $(builddir_name)/$(BUILDTYPE)
+abs_builddir := $(abspath $(builddir))
+depsdir := $(builddir)/.deps
+
+# Object output directory.
+obj := $(builddir)/obj
+abs_obj := $(abspath $(obj))
+
+# We build up a list of every single one of the targets so we can slurp in the
+# generated dependency rule Makefiles in one pass.
+all_deps :=
+
+
+
+CC.target ?= $(CC)
+CFLAGS.target ?= $(CFLAGS)
+CXX.target ?= $(CXX)
+CXXFLAGS.target ?= $(CXXFLAGS)
+LINK.target ?= $(LINK)
+LDFLAGS.target ?= $(LDFLAGS)
+AR.target ?= $(AR)
+
+# C++ apps need to be linked with g++.
+#
+# Note: flock is used to seralize linking. Linking is a memory-intensive
+# process so running parallel links can often lead to thrashing. To disable
+# the serialization, override LINK via an envrionment variable as follows:
+#
+# export LINK=g++
+#
+# This will allow make to invoke N linker processes as specified in -jN.
+LINK ?= flock $(builddir)/linker.lock $(CXX.target)
+
+# TODO(evan): move all cross-compilation logic to gyp-time so we don't need
+# to replicate this environment fallback in make as well.
+CC.host ?= gcc
+CFLAGS.host ?=
+CXX.host ?= g++
+CXXFLAGS.host ?=
+LINK.host ?= $(CXX.host)
+LDFLAGS.host ?=
+AR.host ?= ar
+
+# Define a dir function that can handle spaces.
+# http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions
+# "leading spaces cannot appear in the text of the first argument as written.
+# These characters can be put into the argument value by variable substitution."
+empty :=
+space := $(empty) $(empty)
+
+# http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path-with-spaces
+replace_spaces = $(subst $(space),?,$1)
+unreplace_spaces = $(subst ?,$(space),$1)
+dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1)))
+
+# Flags to make gcc output dependency info. Note that you need to be
+# careful here to use the flags that ccache and distcc can understand.
+# We write to a dep file on the side first and then rename at the end
+# so we can't end up with a broken dep file.
+depfile = $(depsdir)/$(call replace_spaces,$@).d
+DEPFLAGS = -MMD -MF $(depfile).raw
+
+# We have to fixup the deps output in a few ways.
+# (1) the file output should mention the proper .o file.
+# ccache or distcc lose the path to the target, so we convert a rule of
+# the form:
+# foobar.o: DEP1 DEP2
+# into
+# path/to/foobar.o: DEP1 DEP2
+# (2) we want missing files not to cause us to fail to build.
+# We want to rewrite
+# foobar.o: DEP1 DEP2 \
+# DEP3
+# to
+# DEP1:
+# DEP2:
+# DEP3:
+# so if the files are missing, they're just considered phony rules.
+# We have to do some pretty insane escaping to get those backslashes
+# and dollar signs past make, the shell, and sed at the same time.
+# Doesn't work with spaces, but that's fine: .d files have spaces in
+# their names replaced with other characters.
+define fixup_dep
+# The depfile may not exist if the input file didn't have any #includes.
+touch $(depfile).raw
+# Fixup path as in (1).
+sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile)
+# Add extra rules as in (2).
+# We remove slashes and replace spaces with new lines;
+# remove blank lines;
+# delete the first line and append a colon to the remaining lines.
+sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\
+ grep -v '^$$' |\
+ sed -e 1d -e 's|$$|:|' \
+ >> $(depfile)
+rm $(depfile).raw
+endef
+
+# Command definitions:
+# - cmd_foo is the actual command to run;
+# - quiet_cmd_foo is the brief-output summary of the command.
+
+quiet_cmd_cc = CC($(TOOLSET)) $@
+cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $<
+
+quiet_cmd_cxx = CXX($(TOOLSET)) $@
+cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
+
+quiet_cmd_touch = TOUCH $@
+cmd_touch = touch $@
+
+quiet_cmd_copy = COPY $@
+# send stderr to /dev/null to ignore messages when linking directories.
+cmd_copy = rm -rf "$@" && cp -af "$<" "$@"
+
+quiet_cmd_alink = AR($(TOOLSET)) $@
+cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^)
+
+quiet_cmd_alink_thin = AR($(TOOLSET)) $@
+cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^)
+
+# Due to circular dependencies between libraries :(, we wrap the
+# special "figure out circular dependencies" flags around the entire
+# input list during linking.
+quiet_cmd_link = LINK($(TOOLSET)) $@
+cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS)
+
+# We support two kinds of shared objects (.so):
+# 1) shared_library, which is just bundling together many dependent libraries
+# into a link line.
+# 2) loadable_module, which is generating a module intended for dlopen().
+#
+# They differ only slightly:
+# In the former case, we want to package all dependent code into the .so.
+# In the latter case, we want to package just the API exposed by the
+# outermost module.
+# This means shared_library uses --whole-archive, while loadable_module doesn't.
+# (Note that --whole-archive is incompatible with the --start-group used in
+# normal linking.)
+
+# Other shared-object link notes:
+# - Set SONAME to the library filename so our binaries don't reference
+# the local, absolute paths used on the link command-line.
+quiet_cmd_solink = SOLINK($(TOOLSET)) $@
+cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS)
+
+quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
+cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)
+
+
+# Define an escape_quotes function to escape single quotes.
+# This allows us to handle quotes properly as long as we always use
+# use single quotes and escape_quotes.
+escape_quotes = $(subst ','\'',$(1))
+# This comment is here just to include a ' to unconfuse syntax highlighting.
+# Define an escape_vars function to escape '$' variable syntax.
+# This allows us to read/write command lines with shell variables (e.g.
+# $LD_LIBRARY_PATH), without triggering make substitution.
+escape_vars = $(subst $$,$$$$,$(1))
+# Helper that expands to a shell command to echo a string exactly as it is in
+# make. This uses printf instead of echo because printf's behaviour with respect
+# to escape sequences is more portable than echo's across different shells
+# (e.g., dash, bash).
+exact_echo = printf '%s\n' '$(call escape_quotes,$(1))'
+
+# Helper to compare the command we're about to run against the command
+# we logged the last time we ran the command. Produces an empty
+# string (false) when the commands match.
+# Tricky point: Make has no string-equality test function.
+# The kernel uses the following, but it seems like it would have false
+# positives, where one string reordered its arguments.
+# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
+# $(filter-out $(cmd_$@), $(cmd_$(1))))
+# We instead substitute each for the empty string into the other, and
+# say they're equal if both substitutions produce the empty string.
+# .d files contain ? instead of spaces, take that into account.
+command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\
+ $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1))))
+
+# Helper that is non-empty when a prerequisite changes.
+# Normally make does this implicitly, but we force rules to always run
+# so we can check their command lines.
+# $? -- new prerequisites
+# $| -- order-only dependencies
+prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?))
+
+# Helper that executes all postbuilds until one fails.
+define do_postbuilds
+ @E=0;\
+ for p in $(POSTBUILDS); do\
+ eval $$p;\
+ E=$$?;\
+ if [ $$E -ne 0 ]; then\
+ break;\
+ fi;\
+ done;\
+ if [ $$E -ne 0 ]; then\
+ rm -rf "$@";\
+ exit $$E;\
+ fi
+endef
+
+# do_cmd: run a command via the above cmd_foo names, if necessary.
+# Should always run for a given target to handle command-line changes.
+# Second argument, if non-zero, makes it do asm/C/C++ dependency munging.
+# Third argument, if non-zero, makes it do POSTBUILDS processing.
+# Note: We intentionally do NOT call dirx for depfile, since it contains ? for
+# spaces already and dirx strips the ? characters.
+define do_cmd
+$(if $(or $(command_changed),$(prereq_changed)),
+ @$(call exact_echo, $($(quiet)cmd_$(1)))
+ @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))"
+ $(if $(findstring flock,$(word 1,$(cmd_$1))),
+ @$(cmd_$(1))
+ @echo " $(quiet_cmd_$(1)): Finished",
+ @$(cmd_$(1))
+ )
+ @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile)
+ @$(if $(2),$(fixup_dep))
+ $(if $(and $(3), $(POSTBUILDS)),
+ $(call do_postbuilds)
+ )
+)
+endef
+
+# Declare the "all" target first so it is the default,
+# even though we don't have the deps yet.
+.PHONY: all
+all:
+
+# make looks for ways to re-generate included makefiles, but in our case, we
+# don't have a direct way. Explicitly telling make that it has nothing to do
+# for them makes it go faster.
+%.d: ;
+
+# Use FORCE_DO_CMD to force a target to run. Should be coupled with
+# do_cmd.
+.PHONY: FORCE_DO_CMD
+FORCE_DO_CMD:
+
+TOOLSET := target
+# Suffix rules, putting all outputs into $(obj).
+$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+
+# Try building from generated source, too.
+$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+
+$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD
+ @$(call do_cmd,cc,1)
+
+
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+ $(findstring $(join ^,$(prefix)),\
+ $(join ^,bufferutil.target.mk)))),)
+ include bufferutil.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+ $(findstring $(join ^,$(prefix)),\
+ $(join ^,validation.target.mk)))),)
+ include validation.target.mk
+endif
+
+quiet_cmd_regen_makefile = ACTION Regenerating $@
+cmd_regen_makefile = cd $(srcdir); /usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/home/lookshe/dev/git/chat/symple-server-node/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/config.gypi -I/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/home/lookshe/.node-gyp/0.10.36/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/home/lookshe/.node-gyp/0.10.36" "-Dmodule_root_dir=/home/lookshe/dev/git/chat/symple-server-node/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws" binding.gyp
+Makefile: $(srcdir)/../../../../../../../../../../.node-gyp/0.10.36/common.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../../../../../../../../../../usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi
+ $(call do_cmd,regen_makefile)
+
+# "all" is a concatenation of the "all" targets from all the included
+# sub-makefiles. This is just here to clarify.
+all:
+
+# Add in dependency-tracking rules. $(all_deps) is the list of every single
+# target in our tree. Only consider the ones with .d (dependency) info:
+d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d))
+ifneq ($(d_files),)
+ include $(d_files)
+endif
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/bufferutil.node.d b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/bufferutil.node.d
new file mode 100644
index 0000000..03982be
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/bufferutil.node.d
@@ -0,0 +1 @@
+cmd_Release/bufferutil.node := rm -rf "Release/bufferutil.node" && cp -af "Release/obj.target/bufferutil.node" "Release/bufferutil.node"
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/obj.target/bufferutil.node.d b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/obj.target/bufferutil.node.d
new file mode 100644
index 0000000..c329bd5
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/obj.target/bufferutil.node.d
@@ -0,0 +1 @@
+cmd_Release/obj.target/bufferutil.node := flock ./Release/linker.lock g++ -shared -pthread -rdynamic -m64 -Wl,-soname=bufferutil.node -o Release/obj.target/bufferutil.node -Wl,--start-group Release/obj.target/bufferutil/src/bufferutil.o -Wl,--end-group
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d
new file mode 100644
index 0000000..50270cc
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d
@@ -0,0 +1,29 @@
+cmd_Release/obj.target/bufferutil/src/bufferutil.o := g++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/home/lookshe/.node-gyp/0.10.36/src -I/home/lookshe/.node-gyp/0.10.36/deps/uv/include -I/home/lookshe/.node-gyp/0.10.36/deps/v8/include -I../node_modules/nan -fPIC -Wall -Wextra -Wno-unused-parameter -pthread -m64 -O2 -fno-strict-aliasing -fno-tree-vrp -fno-omit-frame-pointer -fno-rtti -fno-exceptions -MMD -MF ./Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d.raw -c -o Release/obj.target/bufferutil/src/bufferutil.o ../src/bufferutil.cc
+Release/obj.target/bufferutil/src/bufferutil.o: ../src/bufferutil.cc \
+ /home/lookshe/.node-gyp/0.10.36/deps/v8/include/v8.h \
+ /home/lookshe/.node-gyp/0.10.36/deps/v8/include/v8stdint.h \
+ /home/lookshe/.node-gyp/0.10.36/src/node.h \
+ /home/lookshe/.node-gyp/0.10.36/deps/uv/include/uv.h \
+ /home/lookshe/.node-gyp/0.10.36/deps/uv/include/uv-private/uv-unix.h \
+ /home/lookshe/.node-gyp/0.10.36/deps/uv/include/uv-private/ngx-queue.h \
+ /home/lookshe/.node-gyp/0.10.36/deps/uv/include/uv-private/uv-linux.h \
+ /home/lookshe/.node-gyp/0.10.36/src/node_object_wrap.h \
+ /home/lookshe/.node-gyp/0.10.36/src/node.h \
+ /home/lookshe/.node-gyp/0.10.36/src/node_buffer.h \
+ /home/lookshe/.node-gyp/0.10.36/src/node_object_wrap.h \
+ ../node_modules/nan/nan.h \
+ /home/lookshe/.node-gyp/0.10.36/src/node_version.h
+../src/bufferutil.cc:
+/home/lookshe/.node-gyp/0.10.36/deps/v8/include/v8.h:
+/home/lookshe/.node-gyp/0.10.36/deps/v8/include/v8stdint.h:
+/home/lookshe/.node-gyp/0.10.36/src/node.h:
+/home/lookshe/.node-gyp/0.10.36/deps/uv/include/uv.h:
+/home/lookshe/.node-gyp/0.10.36/deps/uv/include/uv-private/uv-unix.h:
+/home/lookshe/.node-gyp/0.10.36/deps/uv/include/uv-private/ngx-queue.h:
+/home/lookshe/.node-gyp/0.10.36/deps/uv/include/uv-private/uv-linux.h:
+/home/lookshe/.node-gyp/0.10.36/src/node_object_wrap.h:
+/home/lookshe/.node-gyp/0.10.36/src/node.h:
+/home/lookshe/.node-gyp/0.10.36/src/node_buffer.h:
+/home/lookshe/.node-gyp/0.10.36/src/node_object_wrap.h:
+../node_modules/nan/nan.h:
+/home/lookshe/.node-gyp/0.10.36/src/node_version.h:
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/obj.target/validation.node.d b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/obj.target/validation.node.d
new file mode 100644
index 0000000..f39b7c9
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/obj.target/validation.node.d
@@ -0,0 +1 @@
+cmd_Release/obj.target/validation.node := flock ./Release/linker.lock g++ -shared -pthread -rdynamic -m64 -Wl,-soname=validation.node -o Release/obj.target/validation.node -Wl,--start-group Release/obj.target/validation/src/validation.o -Wl,--end-group
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/obj.target/validation/src/validation.o.d b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/obj.target/validation/src/validation.o.d
new file mode 100644
index 0000000..f905027
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/obj.target/validation/src/validation.o.d
@@ -0,0 +1,29 @@
+cmd_Release/obj.target/validation/src/validation.o := g++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/home/lookshe/.node-gyp/0.10.36/src -I/home/lookshe/.node-gyp/0.10.36/deps/uv/include -I/home/lookshe/.node-gyp/0.10.36/deps/v8/include -I../node_modules/nan -fPIC -Wall -Wextra -Wno-unused-parameter -pthread -m64 -O2 -fno-strict-aliasing -fno-tree-vrp -fno-omit-frame-pointer -fno-rtti -fno-exceptions -MMD -MF ./Release/.deps/Release/obj.target/validation/src/validation.o.d.raw -c -o Release/obj.target/validation/src/validation.o ../src/validation.cc
+Release/obj.target/validation/src/validation.o: ../src/validation.cc \
+ /home/lookshe/.node-gyp/0.10.36/deps/v8/include/v8.h \
+ /home/lookshe/.node-gyp/0.10.36/deps/v8/include/v8stdint.h \
+ /home/lookshe/.node-gyp/0.10.36/src/node.h \
+ /home/lookshe/.node-gyp/0.10.36/deps/uv/include/uv.h \
+ /home/lookshe/.node-gyp/0.10.36/deps/uv/include/uv-private/uv-unix.h \
+ /home/lookshe/.node-gyp/0.10.36/deps/uv/include/uv-private/ngx-queue.h \
+ /home/lookshe/.node-gyp/0.10.36/deps/uv/include/uv-private/uv-linux.h \
+ /home/lookshe/.node-gyp/0.10.36/src/node_object_wrap.h \
+ /home/lookshe/.node-gyp/0.10.36/src/node.h \
+ /home/lookshe/.node-gyp/0.10.36/src/node_buffer.h \
+ /home/lookshe/.node-gyp/0.10.36/src/node_object_wrap.h \
+ ../node_modules/nan/nan.h \
+ /home/lookshe/.node-gyp/0.10.36/src/node_version.h
+../src/validation.cc:
+/home/lookshe/.node-gyp/0.10.36/deps/v8/include/v8.h:
+/home/lookshe/.node-gyp/0.10.36/deps/v8/include/v8stdint.h:
+/home/lookshe/.node-gyp/0.10.36/src/node.h:
+/home/lookshe/.node-gyp/0.10.36/deps/uv/include/uv.h:
+/home/lookshe/.node-gyp/0.10.36/deps/uv/include/uv-private/uv-unix.h:
+/home/lookshe/.node-gyp/0.10.36/deps/uv/include/uv-private/ngx-queue.h:
+/home/lookshe/.node-gyp/0.10.36/deps/uv/include/uv-private/uv-linux.h:
+/home/lookshe/.node-gyp/0.10.36/src/node_object_wrap.h:
+/home/lookshe/.node-gyp/0.10.36/src/node.h:
+/home/lookshe/.node-gyp/0.10.36/src/node_buffer.h:
+/home/lookshe/.node-gyp/0.10.36/src/node_object_wrap.h:
+../node_modules/nan/nan.h:
+/home/lookshe/.node-gyp/0.10.36/src/node_version.h:
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/validation.node.d b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/validation.node.d
new file mode 100644
index 0000000..6b32ade
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/.deps/Release/validation.node.d
@@ -0,0 +1 @@
+cmd_Release/validation.node := rm -rf "Release/validation.node" && cp -af "Release/obj.target/validation.node" "Release/validation.node"
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/bufferutil.node b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/bufferutil.node
new file mode 100755
index 0000000..d42d4a4
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/bufferutil.node
Binary files differ
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/linker.lock b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/linker.lock
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/linker.lock
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/obj.target/bufferutil.node b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/obj.target/bufferutil.node
new file mode 100755
index 0000000..d42d4a4
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/obj.target/bufferutil.node
Binary files differ
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/obj.target/bufferutil/src/bufferutil.o b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/obj.target/bufferutil/src/bufferutil.o
new file mode 100644
index 0000000..7680901
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/obj.target/bufferutil/src/bufferutil.o
Binary files differ
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/obj.target/validation.node b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/obj.target/validation.node
new file mode 100755
index 0000000..2c20239
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/obj.target/validation.node
Binary files differ
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/obj.target/validation/src/validation.o b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/obj.target/validation/src/validation.o
new file mode 100644
index 0000000..7cc4514
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/obj.target/validation/src/validation.o
Binary files differ
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/validation.node b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/validation.node
new file mode 100755
index 0000000..2c20239
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/Release/validation.node
Binary files differ
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/binding.Makefile b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/binding.Makefile
new file mode 100644
index 0000000..3c498cd
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/binding.Makefile
@@ -0,0 +1,6 @@
+# This file is generated by gyp; do not edit.
+
+export builddir_name ?= ./build/.
+.PHONY: all
+all:
+ $(MAKE) bufferutil validation
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/bufferutil.target.mk b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/bufferutil.target.mk
new file mode 100644
index 0000000..76763b1
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/bufferutil.target.mk
@@ -0,0 +1,133 @@
+# This file is generated by gyp; do not edit.
+
+TOOLSET := target
+TARGET := bufferutil
+DEFS_Debug := \
+ '-D_LARGEFILE_SOURCE' \
+ '-D_FILE_OFFSET_BITS=64' \
+ '-DBUILDING_NODE_EXTENSION' \
+ '-DDEBUG' \
+ '-D_DEBUG'
+
+# Flags passed to all source files.
+CFLAGS_Debug := \
+ -fPIC \
+ -Wall \
+ -Wextra \
+ -Wno-unused-parameter \
+ -pthread \
+ -m64 \
+ -O3 \
+ -g \
+ -O0
+
+# Flags passed to only C files.
+CFLAGS_C_Debug :=
+
+# Flags passed to only C++ files.
+CFLAGS_CC_Debug := \
+ -fno-rtti \
+ -fno-exceptions
+
+INCS_Debug := \
+ -I/home/lookshe/.node-gyp/0.10.36/src \
+ -I/home/lookshe/.node-gyp/0.10.36/deps/uv/include \
+ -I/home/lookshe/.node-gyp/0.10.36/deps/v8/include \
+ -I$(srcdir)/node_modules/nan
+
+DEFS_Release := \
+ '-D_LARGEFILE_SOURCE' \
+ '-D_FILE_OFFSET_BITS=64' \
+ '-DBUILDING_NODE_EXTENSION'
+
+# Flags passed to all source files.
+CFLAGS_Release := \
+ -fPIC \
+ -Wall \
+ -Wextra \
+ -Wno-unused-parameter \
+ -pthread \
+ -m64 \
+ -O2 \
+ -fno-strict-aliasing \
+ -fno-tree-vrp \
+ -fno-omit-frame-pointer
+
+# Flags passed to only C files.
+CFLAGS_C_Release :=
+
+# Flags passed to only C++ files.
+CFLAGS_CC_Release := \
+ -fno-rtti \
+ -fno-exceptions
+
+INCS_Release := \
+ -I/home/lookshe/.node-gyp/0.10.36/src \
+ -I/home/lookshe/.node-gyp/0.10.36/deps/uv/include \
+ -I/home/lookshe/.node-gyp/0.10.36/deps/v8/include \
+ -I$(srcdir)/node_modules/nan
+
+OBJS := \
+ $(obj).target/$(TARGET)/src/bufferutil.o
+
+# Add to the list of files we specially track dependencies for.
+all_deps += $(OBJS)
+
+# CFLAGS et al overrides must be target-local.
+# See "Target-specific Variable Values" in the GNU Make manual.
+$(OBJS): TOOLSET := $(TOOLSET)
+$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))
+$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))
+
+# Suffix rules, putting all outputs into $(obj).
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+
+# Try building from generated source, too.
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+
+# End of this set of suffix rules
+### Rules for final target.
+LDFLAGS_Debug := \
+ -pthread \
+ -rdynamic \
+ -m64
+
+LDFLAGS_Release := \
+ -pthread \
+ -rdynamic \
+ -m64
+
+LIBS :=
+
+$(obj).target/bufferutil.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))
+$(obj).target/bufferutil.node: LIBS := $(LIBS)
+$(obj).target/bufferutil.node: TOOLSET := $(TOOLSET)
+$(obj).target/bufferutil.node: $(OBJS) FORCE_DO_CMD
+ $(call do_cmd,solink_module)
+
+all_deps += $(obj).target/bufferutil.node
+# Add target alias
+.PHONY: bufferutil
+bufferutil: $(builddir)/bufferutil.node
+
+# Copy this to the executable output path.
+$(builddir)/bufferutil.node: TOOLSET := $(TOOLSET)
+$(builddir)/bufferutil.node: $(obj).target/bufferutil.node FORCE_DO_CMD
+ $(call do_cmd,copy)
+
+all_deps += $(builddir)/bufferutil.node
+# Short alias for building this executable.
+.PHONY: bufferutil.node
+bufferutil.node: $(obj).target/bufferutil.node $(builddir)/bufferutil.node
+
+# Add executable to "all" target.
+.PHONY: all
+all: $(builddir)/bufferutil.node
+
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/config.gypi b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/config.gypi
new file mode 100644
index 0000000..b2b2466
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/config.gypi
@@ -0,0 +1,122 @@
+# Do not edit. File was generated by node-gyp's "configure" step
+{
+ "target_defaults": {
+ "cflags": [],
+ "default_configuration": "Release",
+ "defines": [],
+ "include_dirs": [],
+ "libraries": []
+ },
+ "variables": {
+ "clang": 0,
+ "gcc_version": 47,
+ "host_arch": "x64",
+ "node_install_npm": "true",
+ "node_prefix": "/usr",
+ "node_shared_cares": "false",
+ "node_shared_http_parser": "false",
+ "node_shared_libuv": "false",
+ "node_shared_openssl": "false",
+ "node_shared_v8": "false",
+ "node_shared_zlib": "false",
+ "node_tag": "",
+ "node_unsafe_optimizations": 0,
+ "node_use_dtrace": "false",
+ "node_use_etw": "false",
+ "node_use_openssl": "true",
+ "node_use_perfctr": "false",
+ "node_use_systemtap": "false",
+ "openssl_no_asm": 0,
+ "python": "/usr/bin/python",
+ "target_arch": "x64",
+ "v8_enable_gdbjit": 0,
+ "v8_no_strict_aliasing": 1,
+ "v8_use_snapshot": "false",
+ "want_separate_host_toolset": 0,
+ "nodedir": "/home/lookshe/.node-gyp/0.10.36",
+ "copy_dev_lib": "true",
+ "standalone_static_library": 1,
+ "cache_lock_stale": "60000",
+ "sign_git_tag": "",
+ "user_agent": "npm/1.4.28 node/v0.10.36 linux x64",
+ "always_auth": "",
+ "bin_links": "true",
+ "key": "",
+ "description": "true",
+ "fetch_retries": "2",
+ "heading": "npm",
+ "user": "",
+ "force": "",
+ "cache_min": "10",
+ "init_license": "ISC",
+ "editor": "vi",
+ "rollback": "true",
+ "cache_max": "Infinity",
+ "userconfig": "/home/lookshe/.npmrc",
+ "engine_strict": "",
+ "init_author_name": "",
+ "init_author_url": "",
+ "tmp": "/tmp",
+ "depth": "Infinity",
+ "save_dev": "",
+ "usage": "",
+ "cafile": "",
+ "https_proxy": "",
+ "onload_script": "",
+ "rebuild_bundle": "true",
+ "save_bundle": "",
+ "shell": "/bin/bash",
+ "prefix": "/usr",
+ "registry": "https://registry.npmjs.org/",
+ "browser": "",
+ "cache_lock_wait": "10000",
+ "save_optional": "",
+ "searchopts": "",
+ "versions": "",
+ "cache": "/home/lookshe/.npm",
+ "ignore_scripts": "",
+ "searchsort": "name",
+ "version": "",
+ "local_address": "",
+ "viewer": "man",
+ "color": "true",
+ "fetch_retry_mintimeout": "10000",
+ "umask": "18",
+ "fetch_retry_maxtimeout": "60000",
+ "message": "%s",
+ "ca": "",
+ "cert": "",
+ "global": "",
+ "link": "",
+ "save": "",
+ "unicode": "true",
+ "long": "",
+ "production": "",
+ "unsafe_perm": "true",
+ "node_version": "0.10.36",
+ "tag": "latest",
+ "git_tag_version": "true",
+ "shrinkwrap": "true",
+ "fetch_retry_factor": "10",
+ "npat": "",
+ "proprietary_attribs": "true",
+ "save_exact": "",
+ "strict_ssl": "true",
+ "username": "",
+ "dev": "",
+ "globalconfig": "/usr/etc/npmrc",
+ "init_module": "/home/lookshe/.npm-init.js",
+ "parseable": "",
+ "globalignorefile": "/usr/etc/npmignore",
+ "cache_lock_retries": "10",
+ "save_prefix": "^",
+ "group": "1001",
+ "init_author_email": "",
+ "searchexclude": "",
+ "git": "git",
+ "optional": "true",
+ "email": "",
+ "json": "",
+ "spin": "true"
+ }
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/validation.target.mk b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/validation.target.mk
new file mode 100644
index 0000000..d566506
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build/validation.target.mk
@@ -0,0 +1,133 @@
+# This file is generated by gyp; do not edit.
+
+TOOLSET := target
+TARGET := validation
+DEFS_Debug := \
+ '-D_LARGEFILE_SOURCE' \
+ '-D_FILE_OFFSET_BITS=64' \
+ '-DBUILDING_NODE_EXTENSION' \
+ '-DDEBUG' \
+ '-D_DEBUG'
+
+# Flags passed to all source files.
+CFLAGS_Debug := \
+ -fPIC \
+ -Wall \
+ -Wextra \
+ -Wno-unused-parameter \
+ -pthread \
+ -m64 \
+ -O3 \
+ -g \
+ -O0
+
+# Flags passed to only C files.
+CFLAGS_C_Debug :=
+
+# Flags passed to only C++ files.
+CFLAGS_CC_Debug := \
+ -fno-rtti \
+ -fno-exceptions
+
+INCS_Debug := \
+ -I/home/lookshe/.node-gyp/0.10.36/src \
+ -I/home/lookshe/.node-gyp/0.10.36/deps/uv/include \
+ -I/home/lookshe/.node-gyp/0.10.36/deps/v8/include \
+ -I$(srcdir)/node_modules/nan
+
+DEFS_Release := \
+ '-D_LARGEFILE_SOURCE' \
+ '-D_FILE_OFFSET_BITS=64' \
+ '-DBUILDING_NODE_EXTENSION'
+
+# Flags passed to all source files.
+CFLAGS_Release := \
+ -fPIC \
+ -Wall \
+ -Wextra \
+ -Wno-unused-parameter \
+ -pthread \
+ -m64 \
+ -O2 \
+ -fno-strict-aliasing \
+ -fno-tree-vrp \
+ -fno-omit-frame-pointer
+
+# Flags passed to only C files.
+CFLAGS_C_Release :=
+
+# Flags passed to only C++ files.
+CFLAGS_CC_Release := \
+ -fno-rtti \
+ -fno-exceptions
+
+INCS_Release := \
+ -I/home/lookshe/.node-gyp/0.10.36/src \
+ -I/home/lookshe/.node-gyp/0.10.36/deps/uv/include \
+ -I/home/lookshe/.node-gyp/0.10.36/deps/v8/include \
+ -I$(srcdir)/node_modules/nan
+
+OBJS := \
+ $(obj).target/$(TARGET)/src/validation.o
+
+# Add to the list of files we specially track dependencies for.
+all_deps += $(OBJS)
+
+# CFLAGS et al overrides must be target-local.
+# See "Target-specific Variable Values" in the GNU Make manual.
+$(OBJS): TOOLSET := $(TOOLSET)
+$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))
+$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))
+
+# Suffix rules, putting all outputs into $(obj).
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+
+# Try building from generated source, too.
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+
+$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD
+ @$(call do_cmd,cxx,1)
+
+# End of this set of suffix rules
+### Rules for final target.
+LDFLAGS_Debug := \
+ -pthread \
+ -rdynamic \
+ -m64
+
+LDFLAGS_Release := \
+ -pthread \
+ -rdynamic \
+ -m64
+
+LIBS :=
+
+$(obj).target/validation.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))
+$(obj).target/validation.node: LIBS := $(LIBS)
+$(obj).target/validation.node: TOOLSET := $(TOOLSET)
+$(obj).target/validation.node: $(OBJS) FORCE_DO_CMD
+ $(call do_cmd,solink_module)
+
+all_deps += $(obj).target/validation.node
+# Add target alias
+.PHONY: validation
+validation: $(builddir)/validation.node
+
+# Copy this to the executable output path.
+$(builddir)/validation.node: TOOLSET := $(TOOLSET)
+$(builddir)/validation.node: $(obj).target/validation.node FORCE_DO_CMD
+ $(call do_cmd,copy)
+
+all_deps += $(builddir)/validation.node
+# Short alias for building this executable.
+.PHONY: validation.node
+validation.node: $(obj).target/validation.node $(builddir)/validation.node
+
+# Add executable to "all" target.
+.PHONY: all
+all: $(builddir)/validation.node
+
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/builderror.log b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/builderror.log
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/builderror.log
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/index.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/index.js
new file mode 100644
index 0000000..3423ff2
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/index.js
@@ -0,0 +1,26 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+module.exports = require('./lib/WebSocket');
+module.exports.Server = require('./lib/WebSocketServer');
+module.exports.Sender = require('./lib/Sender');
+module.exports.Receiver = require('./lib/Receiver');
+
+module.exports.createServer = function (options, connectionListener) {
+ var server = new module.exports.Server(options);
+ if (typeof connectionListener === 'function') {
+ server.on('connection', connectionListener);
+ }
+ return server;
+};
+
+module.exports.connect = module.exports.createConnection = function (address, openListener) {
+ var client = new module.exports(address);
+ if (typeof openListener === 'function') {
+ client.on('open', openListener);
+ }
+ return client;
+};
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferPool.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferPool.js
new file mode 100644
index 0000000..faf8637
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferPool.js
@@ -0,0 +1,59 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var util = require('util');
+
+function BufferPool(initialSize, growStrategy, shrinkStrategy) {
+ if (typeof initialSize === 'function') {
+ shrinkStrategy = growStrategy;
+ growStrategy = initialSize;
+ initialSize = 0;
+ }
+ else if (typeof initialSize === 'undefined') {
+ initialSize = 0;
+ }
+ this._growStrategy = (growStrategy || function(db, size) {
+ return db.used + size;
+ }).bind(null, this);
+ this._shrinkStrategy = (shrinkStrategy || function(db) {
+ return initialSize;
+ }).bind(null, this);
+ this._buffer = initialSize ? new Buffer(initialSize) : null;
+ this._offset = 0;
+ this._used = 0;
+ this._changeFactor = 0;
+ this.__defineGetter__('size', function(){
+ return this._buffer == null ? 0 : this._buffer.length;
+ });
+ this.__defineGetter__('used', function(){
+ return this._used;
+ });
+}
+
+BufferPool.prototype.get = function(length) {
+ if (this._buffer == null || this._offset + length > this._buffer.length) {
+ var newBuf = new Buffer(this._growStrategy(length));
+ this._buffer = newBuf;
+ this._offset = 0;
+ }
+ this._used += length;
+ var buf = this._buffer.slice(this._offset, this._offset + length);
+ this._offset += length;
+ return buf;
+}
+
+BufferPool.prototype.reset = function(forceNewBuffer) {
+ var len = this._shrinkStrategy();
+ if (len < this.size) this._changeFactor -= 1;
+ if (forceNewBuffer || this._changeFactor < -2) {
+ this._changeFactor = 0;
+ this._buffer = len ? new Buffer(len) : null;
+ }
+ this._offset = 0;
+ this._used = 0;
+}
+
+module.exports = BufferPool;
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferUtil.fallback.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferUtil.fallback.js
new file mode 100644
index 0000000..508542c
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferUtil.fallback.js
@@ -0,0 +1,47 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+module.exports.BufferUtil = {
+ merge: function(mergedBuffer, buffers) {
+ var offset = 0;
+ for (var i = 0, l = buffers.length; i < l; ++i) {
+ var buf = buffers[i];
+ buf.copy(mergedBuffer, offset);
+ offset += buf.length;
+ }
+ },
+ mask: function(source, mask, output, offset, length) {
+ var maskNum = mask.readUInt32LE(0, true);
+ var i = 0;
+ for (; i < length - 3; i += 4) {
+ var num = maskNum ^ source.readUInt32LE(i, true);
+ if (num < 0) num = 4294967296 + num;
+ output.writeUInt32LE(num, offset + i, true);
+ }
+ switch (length % 4) {
+ case 3: output[offset + i + 2] = source[i + 2] ^ mask[2];
+ case 2: output[offset + i + 1] = source[i + 1] ^ mask[1];
+ case 1: output[offset + i] = source[i] ^ mask[0];
+ case 0:;
+ }
+ },
+ unmask: function(data, mask) {
+ var maskNum = mask.readUInt32LE(0, true);
+ var length = data.length;
+ var i = 0;
+ for (; i < length - 3; i += 4) {
+ var num = maskNum ^ data.readUInt32LE(i, true);
+ if (num < 0) num = 4294967296 + num;
+ data.writeUInt32LE(num, i, true);
+ }
+ switch (length % 4) {
+ case 3: data[i + 2] = data[i + 2] ^ mask[2];
+ case 2: data[i + 1] = data[i + 1] ^ mask[1];
+ case 1: data[i] = data[i] ^ mask[0];
+ case 0:;
+ }
+ }
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferUtil.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferUtil.js
new file mode 100644
index 0000000..15d35b9
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/BufferUtil.js
@@ -0,0 +1,16 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+try {
+ module.exports = require('../build/Release/bufferutil');
+} catch (e) { try {
+ module.exports = require('../build/default/bufferutil');
+} catch (e) { try {
+ module.exports = require('./BufferUtil.fallback');
+} catch (e) {
+ console.error('bufferutil.node seems to not have been built. Run npm install.');
+ throw e;
+}}}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/ErrorCodes.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/ErrorCodes.js
new file mode 100644
index 0000000..55ebd52
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/ErrorCodes.js
@@ -0,0 +1,24 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+module.exports = {
+ isValidErrorCode: function(code) {
+ return (code >= 1000 && code <= 1011 && code != 1004 && code != 1005 && code != 1006) ||
+ (code >= 3000 && code <= 4999);
+ },
+ 1000: 'normal',
+ 1001: 'going away',
+ 1002: 'protocol error',
+ 1003: 'unsupported data',
+ 1004: 'reserved',
+ 1005: 'reserved for extensions',
+ 1006: 'reserved for extensions',
+ 1007: 'inconsistent or invalid data',
+ 1008: 'policy violation',
+ 1009: 'message too big',
+ 1010: 'extension handshake missing',
+ 1011: 'an unexpected condition prevented the request from being fulfilled',
+}; \ No newline at end of file
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Receiver.hixie.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Receiver.hixie.js
new file mode 100644
index 0000000..a8e41c4
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Receiver.hixie.js
@@ -0,0 +1,180 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var util = require('util');
+
+/**
+ * State constants
+ */
+
+var EMPTY = 0
+ , BODY = 1;
+var BINARYLENGTH = 2
+ , BINARYBODY = 3;
+
+/**
+ * Hixie Receiver implementation
+ */
+
+function Receiver () {
+ this.state = EMPTY;
+ this.buffers = [];
+ this.messageEnd = -1;
+ this.spanLength = 0;
+ this.dead = false;
+
+ this.onerror = function() {};
+ this.ontext = function() {};
+ this.onbinary = function() {};
+ this.onclose = function() {};
+ this.onping = function() {};
+ this.onpong = function() {};
+}
+
+module.exports = Receiver;
+
+/**
+ * Add new data to the parser.
+ *
+ * @api public
+ */
+
+Receiver.prototype.add = function(data) {
+ var self = this;
+ function doAdd() {
+ if (self.state === EMPTY) {
+ if (data.length == 2 && data[0] == 0xFF && data[1] == 0x00) {
+ self.reset();
+ self.onclose();
+ return;
+ }
+ if (data[0] === 0x80) {
+ self.messageEnd = 0;
+ self.state = BINARYLENGTH;
+ data = data.slice(1);
+ } else {
+
+ if (data[0] !== 0x00) {
+ self.error('payload must start with 0x00 byte', true);
+ return;
+ }
+ data = data.slice(1);
+ self.state = BODY;
+
+ }
+ }
+ if (self.state === BINARYLENGTH) {
+ var i = 0;
+ while ((i < data.length) && (data[i] & 0x80)) {
+ self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f);
+ ++i;
+ }
+ if (i < data.length) {
+ self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f);
+ self.state = BINARYBODY;
+ ++i;
+ }
+ if (i > 0)
+ data = data.slice(i);
+ }
+ if (self.state === BINARYBODY) {
+ var dataleft = self.messageEnd - self.spanLength;
+ if (data.length >= dataleft) {
+ // consume the whole buffer to finish the frame
+ self.buffers.push(data);
+ self.spanLength += dataleft;
+ self.messageEnd = dataleft;
+ return self.parse();
+ }
+ // frame's not done even if we consume it all
+ self.buffers.push(data);
+ self.spanLength += data.length;
+ return;
+ }
+ self.buffers.push(data);
+ if ((self.messageEnd = bufferIndex(data, 0xFF)) != -1) {
+ self.spanLength += self.messageEnd;
+ return self.parse();
+ }
+ else self.spanLength += data.length;
+ }
+ while(data) data = doAdd();
+};
+
+/**
+ * Releases all resources used by the receiver.
+ *
+ * @api public
+ */
+
+Receiver.prototype.cleanup = function() {
+ this.dead = true;
+ this.state = EMPTY;
+ this.buffers = [];
+};
+
+/**
+ * Process buffered data.
+ *
+ * @api public
+ */
+
+Receiver.prototype.parse = function() {
+ var output = new Buffer(this.spanLength);
+ var outputIndex = 0;
+ for (var bi = 0, bl = this.buffers.length; bi < bl - 1; ++bi) {
+ var buffer = this.buffers[bi];
+ buffer.copy(output, outputIndex);
+ outputIndex += buffer.length;
+ }
+ var lastBuffer = this.buffers[this.buffers.length - 1];
+ if (this.messageEnd > 0) lastBuffer.copy(output, outputIndex, 0, this.messageEnd);
+ if (this.state !== BODY) --this.messageEnd;
+ var tail = null;
+ if (this.messageEnd < lastBuffer.length - 1) {
+ tail = lastBuffer.slice(this.messageEnd + 1);
+ }
+ this.reset();
+ this.ontext(output.toString('utf8'));
+ return tail;
+};
+
+/**
+ * Handles an error
+ *
+ * @api private
+ */
+
+Receiver.prototype.error = function (reason, terminate) {
+ this.reset();
+ this.onerror(reason, terminate);
+ return this;
+};
+
+/**
+ * Reset parser state
+ *
+ * @api private
+ */
+
+Receiver.prototype.reset = function (reason) {
+ if (this.dead) return;
+ this.state = EMPTY;
+ this.buffers = [];
+ this.messageEnd = -1;
+ this.spanLength = 0;
+};
+
+/**
+ * Internal api
+ */
+
+function bufferIndex(buffer, byte) {
+ for (var i = 0, l = buffer.length; i < l; ++i) {
+ if (buffer[i] === byte) return i;
+ }
+ return -1;
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Receiver.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Receiver.js
new file mode 100644
index 0000000..004cd32
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Receiver.js
@@ -0,0 +1,585 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var util = require('util')
+ , Validation = require('./Validation').Validation
+ , ErrorCodes = require('./ErrorCodes')
+ , BufferPool = require('./BufferPool')
+ , bufferUtil = require('./BufferUtil').BufferUtil;
+
+/**
+ * HyBi Receiver implementation
+ */
+
+function Receiver () {
+ // memory pool for fragmented messages
+ var fragmentedPoolPrevUsed = -1;
+ this.fragmentedBufferPool = new BufferPool(1024, function(db, length) {
+ return db.used + length;
+ }, function(db) {
+ return fragmentedPoolPrevUsed = fragmentedPoolPrevUsed >= 0 ?
+ (fragmentedPoolPrevUsed + db.used) / 2 :
+ db.used;
+ });
+
+ // memory pool for unfragmented messages
+ var unfragmentedPoolPrevUsed = -1;
+ this.unfragmentedBufferPool = new BufferPool(1024, function(db, length) {
+ return db.used + length;
+ }, function(db) {
+ return unfragmentedPoolPrevUsed = unfragmentedPoolPrevUsed >= 0 ?
+ (unfragmentedPoolPrevUsed + db.used) / 2 :
+ db.used;
+ });
+
+ this.state = {
+ activeFragmentedOperation: null,
+ lastFragment: false,
+ masked: false,
+ opcode: 0,
+ fragmentedOperation: false
+ };
+ this.overflow = [];
+ this.headerBuffer = new Buffer(10);
+ this.expectOffset = 0;
+ this.expectBuffer = null;
+ this.expectHandler = null;
+ this.currentMessage = [];
+ this.expectHeader(2, this.processPacket);
+ this.dead = false;
+
+ this.onerror = function() {};
+ this.ontext = function() {};
+ this.onbinary = function() {};
+ this.onclose = function() {};
+ this.onping = function() {};
+ this.onpong = function() {};
+}
+
+module.exports = Receiver;
+
+/**
+ * Add new data to the parser.
+ *
+ * @api public
+ */
+
+Receiver.prototype.add = function(data) {
+ var dataLength = data.length;
+ if (dataLength == 0) return;
+ if (this.expectBuffer == null) {
+ this.overflow.push(data);
+ return;
+ }
+ var toRead = Math.min(dataLength, this.expectBuffer.length - this.expectOffset);
+ fastCopy(toRead, data, this.expectBuffer, this.expectOffset);
+ this.expectOffset += toRead;
+ if (toRead < dataLength) {
+ this.overflow.push(data.slice(toRead));
+ }
+ while (this.expectBuffer && this.expectOffset == this.expectBuffer.length) {
+ var bufferForHandler = this.expectBuffer;
+ this.expectBuffer = null;
+ this.expectOffset = 0;
+ this.expectHandler.call(this, bufferForHandler);
+ }
+};
+
+/**
+ * Releases all resources used by the receiver.
+ *
+ * @api public
+ */
+
+Receiver.prototype.cleanup = function() {
+ this.dead = true;
+ this.overflow = null;
+ this.headerBuffer = null;
+ this.expectBuffer = null;
+ this.expectHandler = null;
+ this.unfragmentedBufferPool = null;
+ this.fragmentedBufferPool = null;
+ this.state = null;
+ this.currentMessage = null;
+ this.onerror = null;
+ this.ontext = null;
+ this.onbinary = null;
+ this.onclose = null;
+ this.onping = null;
+ this.onpong = null;
+};
+
+/**
+ * Waits for a certain amount of header bytes to be available, then fires a callback.
+ *
+ * @api private
+ */
+
+Receiver.prototype.expectHeader = function(length, handler) {
+ if (length == 0) {
+ handler(null);
+ return;
+ }
+ this.expectBuffer = this.headerBuffer.slice(this.expectOffset, this.expectOffset + length);
+ this.expectHandler = handler;
+ var toRead = length;
+ while (toRead > 0 && this.overflow.length > 0) {
+ var fromOverflow = this.overflow.pop();
+ if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead));
+ var read = Math.min(fromOverflow.length, toRead);
+ fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset);
+ this.expectOffset += read;
+ toRead -= read;
+ }
+};
+
+/**
+ * Waits for a certain amount of data bytes to be available, then fires a callback.
+ *
+ * @api private
+ */
+
+Receiver.prototype.expectData = function(length, handler) {
+ if (length == 0) {
+ handler(null);
+ return;
+ }
+ this.expectBuffer = this.allocateFromPool(length, this.state.fragmentedOperation);
+ this.expectHandler = handler;
+ var toRead = length;
+ while (toRead > 0 && this.overflow.length > 0) {
+ var fromOverflow = this.overflow.pop();
+ if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead));
+ var read = Math.min(fromOverflow.length, toRead);
+ fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset);
+ this.expectOffset += read;
+ toRead -= read;
+ }
+};
+
+/**
+ * Allocates memory from the buffer pool.
+ *
+ * @api private
+ */
+
+Receiver.prototype.allocateFromPool = function(length, isFragmented) {
+ return (isFragmented ? this.fragmentedBufferPool : this.unfragmentedBufferPool).get(length);
+};
+
+/**
+ * Start processing a new packet.
+ *
+ * @api private
+ */
+
+Receiver.prototype.processPacket = function (data) {
+ if ((data[0] & 0x70) != 0) {
+ this.error('reserved fields must be empty', 1002);
+ return;
+ }
+ this.state.lastFragment = (data[0] & 0x80) == 0x80;
+ this.state.masked = (data[1] & 0x80) == 0x80;
+ var opcode = data[0] & 0xf;
+ if (opcode === 0) {
+ // continuation frame
+ this.state.fragmentedOperation = true;
+ this.state.opcode = this.state.activeFragmentedOperation;
+ if (!(this.state.opcode == 1 || this.state.opcode == 2)) {
+ this.error('continuation frame cannot follow current opcode', 1002);
+ return;
+ }
+ }
+ else {
+ if (opcode < 3 && this.state.activeFragmentedOperation != null) {
+ this.error('data frames after the initial data frame must have opcode 0', 1002);
+ return;
+ }
+ this.state.opcode = opcode;
+ if (this.state.lastFragment === false) {
+ this.state.fragmentedOperation = true;
+ this.state.activeFragmentedOperation = opcode;
+ }
+ else this.state.fragmentedOperation = false;
+ }
+ var handler = opcodes[this.state.opcode];
+ if (typeof handler == 'undefined') this.error('no handler for opcode ' + this.state.opcode, 1002);
+ else {
+ handler.start.call(this, data);
+ }
+};
+
+/**
+ * Endprocessing a packet.
+ *
+ * @api private
+ */
+
+Receiver.prototype.endPacket = function() {
+ if (!this.state.fragmentedOperation) this.unfragmentedBufferPool.reset(true);
+ else if (this.state.lastFragment) this.fragmentedBufferPool.reset(false);
+ this.expectOffset = 0;
+ this.expectBuffer = null;
+ this.expectHandler = null;
+ if (this.state.lastFragment && this.state.opcode === this.state.activeFragmentedOperation) {
+ // end current fragmented operation
+ this.state.activeFragmentedOperation = null;
+ }
+ this.state.lastFragment = false;
+ this.state.opcode = this.state.activeFragmentedOperation != null ? this.state.activeFragmentedOperation : 0;
+ this.state.masked = false;
+ this.expectHeader(2, this.processPacket);
+};
+
+/**
+ * Reset the parser state.
+ *
+ * @api private
+ */
+
+Receiver.prototype.reset = function() {
+ if (this.dead) return;
+ this.state = {
+ activeFragmentedOperation: null,
+ lastFragment: false,
+ masked: false,
+ opcode: 0,
+ fragmentedOperation: false
+ };
+ this.fragmentedBufferPool.reset(true);
+ this.unfragmentedBufferPool.reset(true);
+ this.expectOffset = 0;
+ this.expectBuffer = null;
+ this.expectHandler = null;
+ this.overflow = [];
+ this.currentMessage = [];
+};
+
+/**
+ * Unmask received data.
+ *
+ * @api private
+ */
+
+Receiver.prototype.unmask = function (mask, buf, binary) {
+ if (mask != null && buf != null) bufferUtil.unmask(buf, mask);
+ if (binary) return buf;
+ return buf != null ? buf.toString('utf8') : '';
+};
+
+/**
+ * Concatenates a list of buffers.
+ *
+ * @api private
+ */
+
+Receiver.prototype.concatBuffers = function(buffers) {
+ var length = 0;
+ for (var i = 0, l = buffers.length; i < l; ++i) length += buffers[i].length;
+ var mergedBuffer = new Buffer(length);
+ bufferUtil.merge(mergedBuffer, buffers);
+ return mergedBuffer;
+};
+
+/**
+ * Handles an error
+ *
+ * @api private
+ */
+
+Receiver.prototype.error = function (reason, protocolErrorCode) {
+ this.reset();
+ this.onerror(reason, protocolErrorCode);
+ return this;
+};
+
+/**
+ * Buffer utilities
+ */
+
+function readUInt16BE(start) {
+ return (this[start]<<8) +
+ this[start+1];
+}
+
+function readUInt32BE(start) {
+ return (this[start]<<24) +
+ (this[start+1]<<16) +
+ (this[start+2]<<8) +
+ this[start+3];
+}
+
+function fastCopy(length, srcBuffer, dstBuffer, dstOffset) {
+ switch (length) {
+ default: srcBuffer.copy(dstBuffer, dstOffset, 0, length); break;
+ case 16: dstBuffer[dstOffset+15] = srcBuffer[15];
+ case 15: dstBuffer[dstOffset+14] = srcBuffer[14];
+ case 14: dstBuffer[dstOffset+13] = srcBuffer[13];
+ case 13: dstBuffer[dstOffset+12] = srcBuffer[12];
+ case 12: dstBuffer[dstOffset+11] = srcBuffer[11];
+ case 11: dstBuffer[dstOffset+10] = srcBuffer[10];
+ case 10: dstBuffer[dstOffset+9] = srcBuffer[9];
+ case 9: dstBuffer[dstOffset+8] = srcBuffer[8];
+ case 8: dstBuffer[dstOffset+7] = srcBuffer[7];
+ case 7: dstBuffer[dstOffset+6] = srcBuffer[6];
+ case 6: dstBuffer[dstOffset+5] = srcBuffer[5];
+ case 5: dstBuffer[dstOffset+4] = srcBuffer[4];
+ case 4: dstBuffer[dstOffset+3] = srcBuffer[3];
+ case 3: dstBuffer[dstOffset+2] = srcBuffer[2];
+ case 2: dstBuffer[dstOffset+1] = srcBuffer[1];
+ case 1: dstBuffer[dstOffset] = srcBuffer[0];
+ }
+}
+
+/**
+ * Opcode handlers
+ */
+
+var opcodes = {
+ // text
+ '1': {
+ start: function(data) {
+ var self = this;
+ // decode length
+ var firstLength = data[1] & 0x7f;
+ if (firstLength < 126) {
+ opcodes['1'].getData.call(self, firstLength);
+ }
+ else if (firstLength == 126) {
+ self.expectHeader(2, function(data) {
+ opcodes['1'].getData.call(self, readUInt16BE.call(data, 0));
+ });
+ }
+ else if (firstLength == 127) {
+ self.expectHeader(8, function(data) {
+ if (readUInt32BE.call(data, 0) != 0) {
+ self.error('packets with length spanning more than 32 bit is currently not supported', 1008);
+ return;
+ }
+ opcodes['1'].getData.call(self, readUInt32BE.call(data, 4));
+ });
+ }
+ },
+ getData: function(length) {
+ var self = this;
+ if (self.state.masked) {
+ self.expectHeader(4, function(data) {
+ var mask = data;
+ self.expectData(length, function(data) {
+ opcodes['1'].finish.call(self, mask, data);
+ });
+ });
+ }
+ else {
+ self.expectData(length, function(data) {
+ opcodes['1'].finish.call(self, null, data);
+ });
+ }
+ },
+ finish: function(mask, data) {
+ var packet = this.unmask(mask, data, true);
+ if (packet != null) this.currentMessage.push(packet);
+ if (this.state.lastFragment) {
+ var messageBuffer = this.concatBuffers(this.currentMessage);
+ if (!Validation.isValidUTF8(messageBuffer)) {
+ this.error('invalid utf8 sequence', 1007);
+ return;
+ }
+ this.ontext(messageBuffer.toString('utf8'), {masked: this.state.masked, buffer: messageBuffer});
+ this.currentMessage = [];
+ }
+ this.endPacket();
+ }
+ },
+ // binary
+ '2': {
+ start: function(data) {
+ var self = this;
+ // decode length
+ var firstLength = data[1] & 0x7f;
+ if (firstLength < 126) {
+ opcodes['2'].getData.call(self, firstLength);
+ }
+ else if (firstLength == 126) {
+ self.expectHeader(2, function(data) {
+ opcodes['2'].getData.call(self, readUInt16BE.call(data, 0));
+ });
+ }
+ else if (firstLength == 127) {
+ self.expectHeader(8, function(data) {
+ if (readUInt32BE.call(data, 0) != 0) {
+ self.error('packets with length spanning more than 32 bit is currently not supported', 1008);
+ return;
+ }
+ opcodes['2'].getData.call(self, readUInt32BE.call(data, 4, true));
+ });
+ }
+ },
+ getData: function(length) {
+ var self = this;
+ if (self.state.masked) {
+ self.expectHeader(4, function(data) {
+ var mask = data;
+ self.expectData(length, function(data) {
+ opcodes['2'].finish.call(self, mask, data);
+ });
+ });
+ }
+ else {
+ self.expectData(length, function(data) {
+ opcodes['2'].finish.call(self, null, data);
+ });
+ }
+ },
+ finish: function(mask, data) {
+ var packet = this.unmask(mask, data, true);
+ if (packet != null) this.currentMessage.push(packet);
+ if (this.state.lastFragment) {
+ var messageBuffer = this.concatBuffers(this.currentMessage);
+ this.onbinary(messageBuffer, {masked: this.state.masked, buffer: messageBuffer});
+ this.currentMessage = [];
+ }
+ this.endPacket();
+ }
+ },
+ // close
+ '8': {
+ start: function(data) {
+ var self = this;
+ if (self.state.lastFragment == false) {
+ self.error('fragmented close is not supported', 1002);
+ return;
+ }
+
+ // decode length
+ var firstLength = data[1] & 0x7f;
+ if (firstLength < 126) {
+ opcodes['8'].getData.call(self, firstLength);
+ }
+ else {
+ self.error('control frames cannot have more than 125 bytes of data', 1002);
+ }
+ },
+ getData: function(length) {
+ var self = this;
+ if (self.state.masked) {
+ self.expectHeader(4, function(data) {
+ var mask = data;
+ self.expectData(length, function(data) {
+ opcodes['8'].finish.call(self, mask, data);
+ });
+ });
+ }
+ else {
+ self.expectData(length, function(data) {
+ opcodes['8'].finish.call(self, null, data);
+ });
+ }
+ },
+ finish: function(mask, data) {
+ var self = this;
+ data = self.unmask(mask, data, true);
+ if (data && data.length == 1) {
+ self.error('close packets with data must be at least two bytes long', 1002);
+ return;
+ }
+ var code = data && data.length > 1 ? readUInt16BE.call(data, 0) : 1000;
+ if (!ErrorCodes.isValidErrorCode(code)) {
+ self.error('invalid error code', 1002);
+ return;
+ }
+ var message = '';
+ if (data && data.length > 2) {
+ var messageBuffer = data.slice(2);
+ if (!Validation.isValidUTF8(messageBuffer)) {
+ self.error('invalid utf8 sequence', 1007);
+ return;
+ }
+ message = messageBuffer.toString('utf8');
+ }
+ this.onclose(code, message, {masked: self.state.masked});
+ this.reset();
+ },
+ },
+ // ping
+ '9': {
+ start: function(data) {
+ var self = this;
+ if (self.state.lastFragment == false) {
+ self.error('fragmented ping is not supported', 1002);
+ return;
+ }
+
+ // decode length
+ var firstLength = data[1] & 0x7f;
+ if (firstLength < 126) {
+ opcodes['9'].getData.call(self, firstLength);
+ }
+ else {
+ self.error('control frames cannot have more than 125 bytes of data', 1002);
+ }
+ },
+ getData: function(length) {
+ var self = this;
+ if (self.state.masked) {
+ self.expectHeader(4, function(data) {
+ var mask = data;
+ self.expectData(length, function(data) {
+ opcodes['9'].finish.call(self, mask, data);
+ });
+ });
+ }
+ else {
+ self.expectData(length, function(data) {
+ opcodes['9'].finish.call(self, null, data);
+ });
+ }
+ },
+ finish: function(mask, data) {
+ this.onping(this.unmask(mask, data, true), {masked: this.state.masked, binary: true});
+ this.endPacket();
+ }
+ },
+ // pong
+ '10': {
+ start: function(data) {
+ var self = this;
+ if (self.state.lastFragment == false) {
+ self.error('fragmented pong is not supported', 1002);
+ return;
+ }
+
+ // decode length
+ var firstLength = data[1] & 0x7f;
+ if (firstLength < 126) {
+ opcodes['10'].getData.call(self, firstLength);
+ }
+ else {
+ self.error('control frames cannot have more than 125 bytes of data', 1002);
+ }
+ },
+ getData: function(length) {
+ var self = this;
+ if (this.state.masked) {
+ this.expectHeader(4, function(data) {
+ var mask = data;
+ self.expectData(length, function(data) {
+ opcodes['10'].finish.call(self, mask, data);
+ });
+ });
+ }
+ else {
+ this.expectData(length, function(data) {
+ opcodes['10'].finish.call(self, null, data);
+ });
+ }
+ },
+ finish: function(mask, data) {
+ this.onpong(this.unmask(mask, data, true), {masked: this.state.masked, binary: true});
+ this.endPacket();
+ }
+ }
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Sender.hixie.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Sender.hixie.js
new file mode 100644
index 0000000..c715dbd
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Sender.hixie.js
@@ -0,0 +1,118 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var events = require('events')
+ , util = require('util')
+ , EventEmitter = events.EventEmitter;
+
+/**
+ * Hixie Sender implementation
+ */
+
+function Sender(socket) {
+ this.socket = socket;
+ this.continuationFrame = false;
+ this.isClosed = false;
+}
+
+module.exports = Sender;
+
+/**
+ * Inherits from EventEmitter.
+ */
+
+util.inherits(Sender, events.EventEmitter);
+
+/**
+ * Frames and writes data.
+ *
+ * @api public
+ */
+
+Sender.prototype.send = function(data, options, cb) {
+ if (this.isClosed) return;
+
+ var isString = typeof data == 'string'
+ , length = isString ? Buffer.byteLength(data) : data.length
+ , lengthbytes = (length > 127) ? 2 : 1 // assume less than 2**14 bytes
+ , writeStartMarker = this.continuationFrame == false
+ , writeEndMarker = !options || !(typeof options.fin != 'undefined' && !options.fin)
+ , buffer = new Buffer((writeStartMarker ? ((options && options.binary) ? (1 + lengthbytes) : 1) : 0) + length + ((writeEndMarker && !(options && options.binary)) ? 1 : 0))
+ , offset = writeStartMarker ? 1 : 0;
+
+ if (writeStartMarker) {
+ if (options && options.binary) {
+ buffer.write('\x80', 'binary');
+ // assume length less than 2**14 bytes
+ if (lengthbytes > 1)
+ buffer.write(String.fromCharCode(128+length/128), offset++, 'binary');
+ buffer.write(String.fromCharCode(length&0x7f), offset++, 'binary');
+ } else
+ buffer.write('\x00', 'binary');
+ }
+
+ if (isString) buffer.write(data, offset, 'utf8');
+ else data.copy(buffer, offset, 0);
+
+ if (writeEndMarker) {
+ if (options && options.binary) {
+ // sending binary, not writing end marker
+ } else
+ buffer.write('\xff', offset + length, 'binary');
+ this.continuationFrame = false;
+ }
+ else this.continuationFrame = true;
+
+ try {
+ this.socket.write(buffer, 'binary', cb);
+ } catch (e) {
+ this.error(e.toString());
+ }
+};
+
+/**
+ * Sends a close instruction to the remote party.
+ *
+ * @api public
+ */
+
+Sender.prototype.close = function(code, data, mask, cb) {
+ if (this.isClosed) return;
+ this.isClosed = true;
+ try {
+ if (this.continuationFrame) this.socket.write(new Buffer([0xff], 'binary'));
+ this.socket.write(new Buffer([0xff, 0x00]), 'binary', cb);
+ } catch (e) {
+ this.error(e.toString());
+ }
+};
+
+/**
+ * Sends a ping message to the remote party. Not available for hixie.
+ *
+ * @api public
+ */
+
+Sender.prototype.ping = function(data, options) {};
+
+/**
+ * Sends a pong message to the remote party. Not available for hixie.
+ *
+ * @api public
+ */
+
+Sender.prototype.pong = function(data, options) {};
+
+/**
+ * Handles an error
+ *
+ * @api private
+ */
+
+Sender.prototype.error = function (reason) {
+ this.emit('error', reason);
+ return this;
+};
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Sender.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Sender.js
new file mode 100644
index 0000000..bc6ea73
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Sender.js
@@ -0,0 +1,227 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var events = require('events')
+ , util = require('util')
+ , EventEmitter = events.EventEmitter
+ , ErrorCodes = require('./ErrorCodes')
+ , bufferUtil = require('./BufferUtil').BufferUtil;
+
+/**
+ * HyBi Sender implementation
+ */
+
+function Sender(socket) {
+ this._socket = socket;
+ this.firstFragment = true;
+}
+
+/**
+ * Inherits from EventEmitter.
+ */
+
+util.inherits(Sender, events.EventEmitter);
+
+/**
+ * Sends a close instruction to the remote party.
+ *
+ * @api public
+ */
+
+Sender.prototype.close = function(code, data, mask) {
+ if (typeof code !== 'undefined') {
+ if (typeof code !== 'number' ||
+ !ErrorCodes.isValidErrorCode(code)) throw new Error('first argument must be a valid error code number');
+ }
+ code = code || 1000;
+ var dataBuffer = new Buffer(2 + (data ? Buffer.byteLength(data) : 0));
+ writeUInt16BE.call(dataBuffer, code, 0);
+ if (dataBuffer.length > 2) dataBuffer.write(data, 2);
+ this.frameAndSend(0x8, dataBuffer, true, mask);
+};
+
+/**
+ * Sends a ping message to the remote party.
+ *
+ * @api public
+ */
+
+Sender.prototype.ping = function(data, options) {
+ var mask = options && options.mask;
+ this.frameAndSend(0x9, data || '', true, mask);
+};
+
+/**
+ * Sends a pong message to the remote party.
+ *
+ * @api public
+ */
+
+Sender.prototype.pong = function(data, options) {
+ var mask = options && options.mask;
+ this.frameAndSend(0xa, data || '', true, mask);
+};
+
+/**
+ * Sends text or binary data to the remote party.
+ *
+ * @api public
+ */
+
+Sender.prototype.send = function(data, options, cb) {
+ var finalFragment = options && options.fin === false ? false : true;
+ var mask = options && options.mask;
+ var opcode = options && options.binary ? 2 : 1;
+ if (this.firstFragment === false) opcode = 0;
+ else this.firstFragment = false;
+ if (finalFragment) this.firstFragment = true
+ this.frameAndSend(opcode, data, finalFragment, mask, cb);
+};
+
+/**
+ * Frames and sends a piece of data according to the HyBi WebSocket protocol.
+ *
+ * @api private
+ */
+
+Sender.prototype.frameAndSend = function(opcode, data, finalFragment, maskData, cb) {
+ var canModifyData = false;
+
+ if (!data) {
+ try {
+ this._socket.write(new Buffer([opcode | (finalFragment ? 0x80 : 0), 0 | (maskData ? 0x80 : 0)].concat(maskData ? [0, 0, 0, 0] : [])), 'binary', cb);
+ }
+ catch (e) {
+ if (typeof cb == 'function') cb(e);
+ else this.emit('error', e);
+ }
+ return;
+ }
+
+ if (!Buffer.isBuffer(data)) {
+ canModifyData = true;
+ if (data && (typeof data.byteLength !== 'undefined' || typeof data.buffer !== 'undefined')) {
+ data = getArrayBuffer(data);
+ } else {
+ data = new Buffer(data);
+ }
+ }
+
+ var dataLength = data.length
+ , dataOffset = maskData ? 6 : 2
+ , secondByte = dataLength;
+
+ if (dataLength >= 65536) {
+ dataOffset += 8;
+ secondByte = 127;
+ }
+ else if (dataLength > 125) {
+ dataOffset += 2;
+ secondByte = 126;
+ }
+
+ var mergeBuffers = dataLength < 32768 || (maskData && !canModifyData);
+ var totalLength = mergeBuffers ? dataLength + dataOffset : dataOffset;
+ var outputBuffer = new Buffer(totalLength);
+ outputBuffer[0] = finalFragment ? opcode | 0x80 : opcode;
+
+ switch (secondByte) {
+ case 126:
+ writeUInt16BE.call(outputBuffer, dataLength, 2);
+ break;
+ case 127:
+ writeUInt32BE.call(outputBuffer, 0, 2);
+ writeUInt32BE.call(outputBuffer, dataLength, 6);
+ }
+
+ if (maskData) {
+ outputBuffer[1] = secondByte | 0x80;
+ var mask = this._randomMask || (this._randomMask = getRandomMask());
+ outputBuffer[dataOffset - 4] = mask[0];
+ outputBuffer[dataOffset - 3] = mask[1];
+ outputBuffer[dataOffset - 2] = mask[2];
+ outputBuffer[dataOffset - 1] = mask[3];
+ if (mergeBuffers) {
+ bufferUtil.mask(data, mask, outputBuffer, dataOffset, dataLength);
+ try {
+ this._socket.write(outputBuffer, 'binary', cb);
+ }
+ catch (e) {
+ if (typeof cb == 'function') cb(e);
+ else this.emit('error', e);
+ }
+ }
+ else {
+ bufferUtil.mask(data, mask, data, 0, dataLength);
+ try {
+ this._socket.write(outputBuffer, 'binary');
+ this._socket.write(data, 'binary', cb);
+ }
+ catch (e) {
+ if (typeof cb == 'function') cb(e);
+ else this.emit('error', e);
+ }
+ }
+ }
+ else {
+ outputBuffer[1] = secondByte;
+ if (mergeBuffers) {
+ data.copy(outputBuffer, dataOffset);
+ try {
+ this._socket.write(outputBuffer, 'binary', cb);
+ }
+ catch (e) {
+ if (typeof cb == 'function') cb(e);
+ else this.emit('error', e);
+ }
+ }
+ else {
+ try {
+ this._socket.write(outputBuffer, 'binary');
+ this._socket.write(data, 'binary', cb);
+ }
+ catch (e) {
+ if (typeof cb == 'function') cb(e);
+ else this.emit('error', e);
+ }
+ }
+ }
+};
+
+module.exports = Sender;
+
+function writeUInt16BE(value, offset) {
+ this[offset] = (value & 0xff00)>>8;
+ this[offset+1] = value & 0xff;
+}
+
+function writeUInt32BE(value, offset) {
+ this[offset] = (value & 0xff000000)>>24;
+ this[offset+1] = (value & 0xff0000)>>16;
+ this[offset+2] = (value & 0xff00)>>8;
+ this[offset+3] = value & 0xff;
+}
+
+function getArrayBuffer(data) {
+ // data is either an ArrayBuffer or ArrayBufferView.
+ var array = new Uint8Array(data.buffer || data)
+ , l = data.byteLength || data.length
+ , o = data.byteOffset || 0
+ , buffer = new Buffer(l);
+ for (var i = 0; i < l; ++i) {
+ buffer[i] = array[o+i];
+ }
+ return buffer;
+}
+
+function getRandomMask() {
+ return new Buffer([
+ ~~(Math.random() * 255),
+ ~~(Math.random() * 255),
+ ~~(Math.random() * 255),
+ ~~(Math.random() * 255)
+ ]);
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Validation.fallback.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Validation.fallback.js
new file mode 100644
index 0000000..2c7c4fd
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Validation.fallback.js
@@ -0,0 +1,12 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+module.exports.Validation = {
+ isValidUTF8: function(buffer) {
+ return true;
+ }
+};
+
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Validation.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Validation.js
new file mode 100644
index 0000000..0f3109a
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/Validation.js
@@ -0,0 +1,16 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+try {
+ module.exports = require('../build/Release/validation');
+} catch (e) { try {
+ module.exports = require('../build/default/validation');
+} catch (e) { try {
+ module.exports = require('./Validation.fallback');
+} catch (e) {
+ console.error('validation.node seems to not have been built. Run npm install.');
+ throw e;
+}}}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/WebSocket.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/WebSocket.js
new file mode 100644
index 0000000..8c304eb
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/WebSocket.js
@@ -0,0 +1,794 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var util = require('util')
+ , events = require('events')
+ , http = require('http')
+ , https = require('https')
+ , crypto = require('crypto')
+ , url = require('url')
+ , stream = require('stream')
+ , Options = require('options')
+ , Sender = require('./Sender')
+ , Receiver = require('./Receiver')
+ , SenderHixie = require('./Sender.hixie')
+ , ReceiverHixie = require('./Receiver.hixie');
+
+/**
+ * Constants
+ */
+
+// Default protocol version
+
+var protocolVersion = 13;
+
+// Close timeout
+
+var closeTimeout = 30000; // Allow 5 seconds to terminate the connection cleanly
+
+/**
+ * WebSocket implementation
+ */
+
+function WebSocket(address, protocols, options) {
+
+ if (protocols && !Array.isArray(protocols) && 'object' == typeof protocols) {
+ // accept the "options" Object as the 2nd argument
+ options = protocols;
+ protocols = null;
+ }
+ if ('string' == typeof protocols) {
+ protocols = [ protocols ];
+ }
+ if (!Array.isArray(protocols)) {
+ protocols = [];
+ }
+ // TODO: actually handle the `Sub-Protocols` part of the WebSocket client
+
+ this._socket = null;
+ this.bytesReceived = 0;
+ this.readyState = null;
+ this.supports = {};
+
+ if (Array.isArray(address)) {
+ initAsServerClient.apply(this, address.concat(options));
+ } else {
+ initAsClient.apply(this, [address, protocols, options]);
+ }
+}
+
+/**
+ * Inherits from EventEmitter.
+ */
+
+util.inherits(WebSocket, events.EventEmitter);
+
+/**
+ * Ready States
+ */
+
+["CONNECTING", "OPEN", "CLOSING", "CLOSED"].forEach(function (state, index) {
+ WebSocket.prototype[state] = WebSocket[state] = index;
+});
+
+/**
+ * Gracefully closes the connection, after sending a description message to the server
+ *
+ * @param {Object} data to be sent to the server
+ * @api public
+ */
+
+WebSocket.prototype.close = function(code, data) {
+ if (this.readyState == WebSocket.CLOSING || this.readyState == WebSocket.CLOSED) return;
+ if (this.readyState == WebSocket.CONNECTING) {
+ this.readyState = WebSocket.CLOSED;
+ return;
+ }
+ try {
+ this.readyState = WebSocket.CLOSING;
+ this._closeCode = code;
+ this._closeMessage = data;
+ var mask = !this._isServer;
+ this._sender.close(code, data, mask);
+ }
+ catch (e) {
+ this.emit('error', e);
+ }
+ finally {
+ this.terminate();
+ }
+}
+
+/**
+ * Pause the client stream
+ *
+ * @api public
+ */
+
+WebSocket.prototype.pause = function() {
+ if (this.readyState != WebSocket.OPEN) throw new Error('not opened');
+ return this._socket.pause();
+}
+
+/**
+ * Sends a ping
+ *
+ * @param {Object} data to be sent to the server
+ * @param {Object} Members - mask: boolean, binary: boolean
+ * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open
+ * @api public
+ */
+
+WebSocket.prototype.ping = function(data, options, dontFailWhenClosed) {
+ if (this.readyState != WebSocket.OPEN) {
+ if (dontFailWhenClosed === true) return;
+ throw new Error('not opened');
+ }
+ options = options || {};
+ if (typeof options.mask == 'undefined') options.mask = !this._isServer;
+ this._sender.ping(data, options);
+}
+
+/**
+ * Sends a pong
+ *
+ * @param {Object} data to be sent to the server
+ * @param {Object} Members - mask: boolean, binary: boolean
+ * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open
+ * @api public
+ */
+
+WebSocket.prototype.pong = function(data, options, dontFailWhenClosed) {
+ if (this.readyState != WebSocket.OPEN) {
+ if (dontFailWhenClosed === true) return;
+ throw new Error('not opened');
+ }
+ options = options || {};
+ if (typeof options.mask == 'undefined') options.mask = !this._isServer;
+ this._sender.pong(data, options);
+}
+
+/**
+ * Resume the client stream
+ *
+ * @api public
+ */
+
+WebSocket.prototype.resume = function() {
+ if (this.readyState != WebSocket.OPEN) throw new Error('not opened');
+ return this._socket.resume();
+}
+
+/**
+ * Sends a piece of data
+ *
+ * @param {Object} data to be sent to the server
+ * @param {Object} Members - mask: boolean, binary: boolean
+ * @param {function} Optional callback which is executed after the send completes
+ * @api public
+ */
+
+WebSocket.prototype.send = function(data, options, cb) {
+ if (typeof options == 'function') {
+ cb = options;
+ options = {};
+ }
+ if (this.readyState != WebSocket.OPEN) {
+ if (typeof cb == 'function') cb(new Error('not opened'));
+ else throw new Error('not opened');
+ return;
+ }
+ if (!data) data = '';
+ if (this._queue) {
+ var self = this;
+ this._queue.push(function() { self.send(data, options, cb); });
+ return;
+ }
+ options = options || {};
+ options.fin = true;
+ if (typeof options.binary == 'undefined') {
+ options.binary = (data instanceof ArrayBuffer || data instanceof Buffer ||
+ data instanceof Uint8Array ||
+ data instanceof Uint16Array ||
+ data instanceof Uint32Array ||
+ data instanceof Int8Array ||
+ data instanceof Int16Array ||
+ data instanceof Int32Array ||
+ data instanceof Float32Array ||
+ data instanceof Float64Array);
+ }
+ if (typeof options.mask == 'undefined') options.mask = !this._isServer;
+ var readable = typeof stream.Readable == 'function' ? stream.Readable : stream.Stream;
+ if (data instanceof readable) {
+ startQueue(this);
+ var self = this;
+ sendStream(this, data, options, function(error) {
+ process.nextTick(function() { executeQueueSends(self); });
+ if (typeof cb == 'function') cb(error);
+ });
+ }
+ else this._sender.send(data, options, cb);
+}
+
+/**
+ * Streams data through calls to a user supplied function
+ *
+ * @param {Object} Members - mask: boolean, binary: boolean
+ * @param {function} 'function (error, send)' which is executed on successive ticks of which send is 'function (data, final)'.
+ * @api public
+ */
+
+WebSocket.prototype.stream = function(options, cb) {
+ if (typeof options == 'function') {
+ cb = options;
+ options = {};
+ }
+ var self = this;
+ if (typeof cb != 'function') throw new Error('callback must be provided');
+ if (this.readyState != WebSocket.OPEN) {
+ if (typeof cb == 'function') cb(new Error('not opened'));
+ else throw new Error('not opened');
+ return;
+ }
+ if (this._queue) {
+ this._queue.push(function() { self.stream(options, cb); });
+ return;
+ }
+ options = options || {};
+ if (typeof options.mask == 'undefined') options.mask = !this._isServer;
+ startQueue(this);
+ var send = function(data, final) {
+ try {
+ if (self.readyState != WebSocket.OPEN) throw new Error('not opened');
+ options.fin = final === true;
+ self._sender.send(data, options);
+ if (!final) process.nextTick(cb.bind(null, null, send));
+ else executeQueueSends(self);
+ }
+ catch (e) {
+ if (typeof cb == 'function') cb(e);
+ else {
+ delete self._queue;
+ self.emit('error', e);
+ }
+ }
+ }
+ process.nextTick(cb.bind(null, null, send));
+}
+
+/**
+ * Immediately shuts down the connection
+ *
+ * @api public
+ */
+
+WebSocket.prototype.terminate = function() {
+ if (this.readyState == WebSocket.CLOSED) return;
+ if (this._socket) {
+ try {
+ // End the connection
+ this._socket.end();
+ }
+ catch (e) {
+ // Socket error during end() call, so just destroy it right now
+ cleanupWebsocketResources.call(this, true);
+ return;
+ }
+
+ // Add a timeout to ensure that the connection is completely
+ // cleaned up within 30 seconds, even if the clean close procedure
+ // fails for whatever reason
+ this._closeTimer = setTimeout(cleanupWebsocketResources.bind(this, true), closeTimeout);
+ }
+ else if (this.readyState == WebSocket.CONNECTING) {
+ cleanupWebsocketResources.call(this, true);
+ }
+};
+
+/**
+ * Expose bufferedAmount
+ *
+ * @api public
+ */
+
+Object.defineProperty(WebSocket.prototype, 'bufferedAmount', {
+ get: function get() {
+ var amount = 0;
+ if (this._socket) {
+ amount = this._socket.bufferSize || 0;
+ }
+ return amount;
+ }
+});
+
+/**
+ * Emulates the W3C Browser based WebSocket interface using function members.
+ *
+ * @see http://dev.w3.org/html5/websockets/#the-websocket-interface
+ * @api public
+ */
+
+['open', 'error', 'close', 'message'].forEach(function(method) {
+ Object.defineProperty(WebSocket.prototype, 'on' + method, {
+ /**
+ * Returns the current listener
+ *
+ * @returns {Mixed} the set function or undefined
+ * @api public
+ */
+
+ get: function get() {
+ var listener = this.listeners(method)[0];
+ return listener ? (listener._listener ? listener._listener : listener) : undefined;
+ },
+
+ /**
+ * Start listening for events
+ *
+ * @param {Function} listener the listener
+ * @returns {Mixed} the set function or undefined
+ * @api public
+ */
+
+ set: function set(listener) {
+ this.removeAllListeners(method);
+ this.addEventListener(method, listener);
+ }
+ });
+});
+
+/**
+ * Emulates the W3C Browser based WebSocket interface using addEventListener.
+ *
+ * @see https://developer.mozilla.org/en/DOM/element.addEventListener
+ * @see http://dev.w3.org/html5/websockets/#the-websocket-interface
+ * @api public
+ */
+WebSocket.prototype.addEventListener = function(method, listener) {
+ var target = this;
+ if (typeof listener === 'function') {
+ if (method === 'message') {
+ function onMessage (data, flags) {
+ listener.call(this, new MessageEvent(data, flags.binary ? 'Binary' : 'Text', target));
+ }
+ // store a reference so we can return the original function from the addEventListener hook
+ onMessage._listener = listener;
+ this.on(method, onMessage);
+ } else if (method === 'close') {
+ function onClose (code, message) {
+ listener.call(this, new CloseEvent(code, message, target));
+ }
+ // store a reference so we can return the original function from the addEventListener hook
+ onClose._listener = listener;
+ this.on(method, onClose);
+ } else if (method === 'error') {
+ function onError (event) {
+ event.target = target;
+ listener.call(this, event);
+ }
+ // store a reference so we can return the original function from the addEventListener hook
+ onError._listener = listener;
+ this.on(method, onError);
+ } else if (method === 'open') {
+ function onOpen () {
+ listener.call(this, new OpenEvent(target));
+ }
+ // store a reference so we can return the original function from the addEventListener hook
+ onOpen._listener = listener;
+ this.on(method, onOpen);
+ } else {
+ this.on(method, listener);
+ }
+ }
+}
+
+module.exports = WebSocket;
+
+/**
+ * W3C MessageEvent
+ *
+ * @see http://www.w3.org/TR/html5/comms.html
+ * @api private
+ */
+
+function MessageEvent(dataArg, typeArg, target) {
+ this.data = dataArg;
+ this.type = typeArg;
+ this.target = target;
+}
+
+/**
+ * W3C CloseEvent
+ *
+ * @see http://www.w3.org/TR/html5/comms.html
+ * @api private
+ */
+
+function CloseEvent(code, reason, target) {
+ this.wasClean = (typeof code == 'undefined' || code == 1000);
+ this.code = code;
+ this.reason = reason;
+ this.target = target;
+}
+
+/**
+ * W3C OpenEvent
+ *
+ * @see http://www.w3.org/TR/html5/comms.html
+ * @api private
+ */
+
+function OpenEvent(target) {
+ this.target = target;
+}
+
+/**
+ * Entirely private apis,
+ * which may or may not be bound to a sepcific WebSocket instance.
+ */
+
+function initAsServerClient(req, socket, upgradeHead, options) {
+ options = new Options({
+ protocolVersion: protocolVersion,
+ protocol: null
+ }).merge(options);
+
+ // expose state properties
+ this.protocol = options.value.protocol;
+ this.protocolVersion = options.value.protocolVersion;
+ this.supports.binary = (this.protocolVersion != 'hixie-76');
+ this.upgradeReq = req;
+ this.readyState = WebSocket.CONNECTING;
+ this._isServer = true;
+
+ // establish connection
+ if (options.value.protocolVersion == 'hixie-76') establishConnection.call(this, ReceiverHixie, SenderHixie, socket, upgradeHead);
+ else establishConnection.call(this, Receiver, Sender, socket, upgradeHead);
+}
+
+function initAsClient(address, protocols, options) {
+ options = new Options({
+ origin: null,
+ protocolVersion: protocolVersion,
+ host: null,
+ headers: null,
+ protocol: null,
+ agent: null,
+
+ // ssl-related options
+ pfx: null,
+ key: null,
+ passphrase: null,
+ cert: null,
+ ca: null,
+ ciphers: null,
+ rejectUnauthorized: null
+ }).merge(options);
+ if (options.value.protocolVersion != 8 && options.value.protocolVersion != 13) {
+ throw new Error('unsupported protocol version');
+ }
+
+ // verify url and establish http class
+ var serverUrl = url.parse(address);
+ var isUnixSocket = serverUrl.protocol === 'ws+unix:';
+ if (!serverUrl.host && !isUnixSocket) throw new Error('invalid url');
+ var isSecure = serverUrl.protocol === 'wss:' || serverUrl.protocol === 'https:';
+ var httpObj = isSecure ? https : http;
+ var port = serverUrl.port || (isSecure ? 443 : 80);
+ var auth = serverUrl.auth;
+
+ // expose state properties
+ this._isServer = false;
+ this.url = address;
+ this.protocolVersion = options.value.protocolVersion;
+ this.supports.binary = (this.protocolVersion != 'hixie-76');
+
+ // begin handshake
+ var key = new Buffer(options.value.protocolVersion + '-' + Date.now()).toString('base64');
+ var shasum = crypto.createHash('sha1');
+ shasum.update(key + '258EAFA5-E914-47DA-95CA-C5AB0DC85B11');
+ var expectedServerKey = shasum.digest('base64');
+
+ var agent = options.value.agent;
+
+ var headerHost = serverUrl.hostname;
+ // Append port number to Host and Origin header, only if specified in the url and non-default
+ if(serverUrl.port) {
+ if((isSecure && (port != 443)) || (!isSecure && (port != 80))){
+ headerHost = headerHost + ':' + port;
+ }
+ }
+
+ var requestOptions = {
+ port: port,
+ host: serverUrl.hostname,
+ headers: {
+ 'Connection': 'Upgrade',
+ 'Upgrade': 'websocket',
+ 'Host': headerHost,
+ 'Origin': headerHost,
+ 'Sec-WebSocket-Version': options.value.protocolVersion,
+ 'Sec-WebSocket-Key': key
+ }
+ };
+
+ // If we have basic auth.
+ if (auth) {
+ requestOptions.headers['Authorization'] = 'Basic ' + new Buffer(auth).toString('base64');
+ }
+
+ if (options.value.protocol) {
+ requestOptions.headers['Sec-WebSocket-Protocol'] = options.value.protocol;
+ }
+
+ if (options.value.host) {
+ requestOptions.headers['Host'] = options.value.host;
+ }
+
+ if (options.value.headers) {
+ for (var header in options.value.headers) {
+ if (options.value.headers.hasOwnProperty(header)) {
+ requestOptions.headers[header] = options.value.headers[header];
+ }
+ }
+ }
+
+ if (options.isDefinedAndNonNull('pfx')
+ || options.isDefinedAndNonNull('key')
+ || options.isDefinedAndNonNull('passphrase')
+ || options.isDefinedAndNonNull('cert')
+ || options.isDefinedAndNonNull('ca')
+ || options.isDefinedAndNonNull('ciphers')
+ || options.isDefinedAndNonNull('rejectUnauthorized')) {
+
+ if (options.isDefinedAndNonNull('pfx')) requestOptions.pfx = options.value.pfx;
+ if (options.isDefinedAndNonNull('key')) requestOptions.key = options.value.key;
+ if (options.isDefinedAndNonNull('passphrase')) requestOptions.passphrase = options.value.passphrase;
+ if (options.isDefinedAndNonNull('cert')) requestOptions.cert = options.value.cert;
+ if (options.isDefinedAndNonNull('ca')) requestOptions.ca = options.value.ca;
+ if (options.isDefinedAndNonNull('ciphers')) requestOptions.ciphers = options.value.ciphers;
+ if (options.isDefinedAndNonNull('rejectUnauthorized')) requestOptions.rejectUnauthorized = options.value.rejectUnauthorized;
+
+ if (!agent) {
+ // global agent ignores client side certificates
+ agent = new httpObj.Agent(requestOptions);
+ }
+ }
+
+ requestOptions.path = serverUrl.path || '/';
+
+ if (agent) {
+ requestOptions.agent = agent;
+ }
+
+ if (isUnixSocket) {
+ requestOptions.socketPath = serverUrl.pathname;
+ }
+ if (options.value.origin) {
+ if (options.value.protocolVersion < 13) requestOptions.headers['Sec-WebSocket-Origin'] = options.value.origin;
+ else requestOptions.headers['Origin'] = options.value.origin;
+ }
+
+ var self = this;
+ var req = httpObj.request(requestOptions);
+
+ req.on('error', function(error) {
+ self.emit('error', error);
+ cleanupWebsocketResources.call(this, error);
+ });
+
+ req.once('response', function(res) {
+ if (!self.emit('unexpected-response', req, res)) {
+ var error = new Error('unexpected server response (' + res.statusCode + ')');
+ req.abort();
+ self.emit('error', error);
+ }
+ cleanupWebsocketResources.call(this, error);
+ });
+
+ req.once('upgrade', function(res, socket, upgradeHead) {
+ if (self.readyState == WebSocket.CLOSED) {
+ // client closed before server accepted connection
+ self.emit('close');
+ self.removeAllListeners();
+ socket.end();
+ return;
+ }
+ var serverKey = res.headers['sec-websocket-accept'];
+ if (typeof serverKey == 'undefined' || serverKey !== expectedServerKey) {
+ self.emit('error', 'invalid server key');
+ self.removeAllListeners();
+ socket.end();
+ return;
+ }
+
+ var serverProt = res.headers['sec-websocket-protocol'];
+ var protList = (options.value.protocol || "").split(/, */);
+ var protError = null;
+ if (!options.value.protocol && serverProt) {
+ protError = 'server sent a subprotocol even though none requested';
+ } else if (options.value.protocol && !serverProt) {
+ protError = 'server sent no subprotocol even though requested';
+ } else if (serverProt && protList.indexOf(serverProt) === -1) {
+ protError = 'server responded with an invalid protocol';
+ }
+ if (protError) {
+ self.emit('error', protError);
+ self.removeAllListeners();
+ socket.end();
+ return;
+ } else if (serverProt) {
+ self.protocol = serverProt;
+ }
+
+ establishConnection.call(self, Receiver, Sender, socket, upgradeHead);
+
+ // perform cleanup on http resources
+ req.removeAllListeners();
+ req = null;
+ agent = null;
+ });
+
+ req.end();
+ this.readyState = WebSocket.CONNECTING;
+}
+
+function establishConnection(ReceiverClass, SenderClass, socket, upgradeHead) {
+ this._socket = socket;
+ socket.setTimeout(0);
+ socket.setNoDelay(true);
+ var self = this;
+ this._receiver = new ReceiverClass();
+
+ // socket cleanup handlers
+ socket.on('end', cleanupWebsocketResources.bind(this));
+ socket.on('close', cleanupWebsocketResources.bind(this));
+ socket.on('error', cleanupWebsocketResources.bind(this));
+
+ // ensure that the upgradeHead is added to the receiver
+ function firstHandler(data) {
+ if (self.readyState != WebSocket.OPEN) return;
+ if (upgradeHead && upgradeHead.length > 0) {
+ self.bytesReceived += upgradeHead.length;
+ var head = upgradeHead;
+ upgradeHead = null;
+ self._receiver.add(head);
+ }
+ dataHandler = realHandler;
+ if (data) {
+ self.bytesReceived += data.length;
+ self._receiver.add(data);
+ }
+ }
+ // subsequent packets are pushed straight to the receiver
+ function realHandler(data) {
+ if (data) self.bytesReceived += data.length;
+ self._receiver.add(data);
+ }
+ var dataHandler = firstHandler;
+ // if data was passed along with the http upgrade,
+ // this will schedule a push of that on to the receiver.
+ // this has to be done on next tick, since the caller
+ // hasn't had a chance to set event handlers on this client
+ // object yet.
+ process.nextTick(firstHandler);
+
+ // receiver event handlers
+ self._receiver.ontext = function (data, flags) {
+ flags = flags || {};
+ self.emit('message', data, flags);
+ };
+ self._receiver.onbinary = function (data, flags) {
+ flags = flags || {};
+ flags.binary = true;
+ self.emit('message', data, flags);
+ };
+ self._receiver.onping = function(data, flags) {
+ flags = flags || {};
+ self.pong(data, {mask: !self._isServer, binary: flags.binary === true}, true);
+ self.emit('ping', data, flags);
+ };
+ self._receiver.onpong = function(data, flags) {
+ self.emit('pong', data, flags);
+ };
+ self._receiver.onclose = function(code, data, flags) {
+ flags = flags || {};
+ self.close(code, data);
+ };
+ self._receiver.onerror = function(reason, errorCode) {
+ // close the connection when the receiver reports a HyBi error code
+ self.close(typeof errorCode != 'undefined' ? errorCode : 1002, '');
+ self.emit('error', reason, errorCode);
+ };
+
+ // finalize the client
+ this._sender = new SenderClass(socket);
+ this._sender.on('error', function(error) {
+ self.close(1002, '');
+ self.emit('error', error);
+ });
+ this.readyState = WebSocket.OPEN;
+ this.emit('open');
+
+ socket.on('data', dataHandler);
+}
+
+function startQueue(instance) {
+ instance._queue = instance._queue || [];
+}
+
+function executeQueueSends(instance) {
+ var queue = instance._queue;
+ if (typeof queue == 'undefined') return;
+ delete instance._queue;
+ for (var i = 0, l = queue.length; i < l; ++i) {
+ queue[i]();
+ }
+}
+
+function sendStream(instance, stream, options, cb) {
+ stream.on('data', function(data) {
+ if (instance.readyState != WebSocket.OPEN) {
+ if (typeof cb == 'function') cb(new Error('not opened'));
+ else {
+ delete instance._queue;
+ instance.emit('error', new Error('not opened'));
+ }
+ return;
+ }
+ options.fin = false;
+ instance._sender.send(data, options);
+ });
+ stream.on('end', function() {
+ if (instance.readyState != WebSocket.OPEN) {
+ if (typeof cb == 'function') cb(new Error('not opened'));
+ else {
+ delete instance._queue;
+ instance.emit('error', new Error('not opened'));
+ }
+ return;
+ }
+ options.fin = true;
+ instance._sender.send(null, options);
+ if (typeof cb == 'function') cb(null);
+ });
+}
+
+function cleanupWebsocketResources(error) {
+ if (this.readyState == WebSocket.CLOSED) return;
+ var emitClose = this.readyState != WebSocket.CONNECTING;
+ this.readyState = WebSocket.CLOSED;
+
+ clearTimeout(this._closeTimer);
+ this._closeTimer = null;
+ if (emitClose) this.emit('close', this._closeCode || 1000, this._closeMessage || '');
+
+ if (this._socket) {
+ this._socket.removeAllListeners();
+ // catch all socket error after removing all standard handlers
+ var socket = this._socket;
+ this._socket.on('error', function() {
+ try { socket.destroy(); } catch (e) {}
+ });
+ try {
+ if (!error) this._socket.end();
+ else this._socket.destroy();
+ }
+ catch (e) { /* Ignore termination errors */ }
+ this._socket = null;
+ }
+ if (this._sender) {
+ this._sender.removeAllListeners();
+ this._sender = null;
+ }
+ if (this._receiver) {
+ this._receiver.cleanup();
+ this._receiver = null;
+ }
+ this.removeAllListeners();
+ this.on('error', function() {}); // catch all errors after this
+ delete this._queue;
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/WebSocketServer.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/WebSocketServer.js
new file mode 100644
index 0000000..5cbd195
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/WebSocketServer.js
@@ -0,0 +1,465 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var util = require('util')
+ , events = require('events')
+ , http = require('http')
+ , crypto = require('crypto')
+ , Options = require('options')
+ , WebSocket = require('./WebSocket')
+ , tls = require('tls')
+ , url = require('url');
+
+/**
+ * WebSocket Server implementation
+ */
+
+function WebSocketServer(options, callback) {
+ options = new Options({
+ host: '0.0.0.0',
+ port: null,
+ server: null,
+ verifyClient: null,
+ handleProtocols: null,
+ path: null,
+ noServer: false,
+ disableHixie: false,
+ clientTracking: true
+ }).merge(options);
+
+ if (!options.isDefinedAndNonNull('port') && !options.isDefinedAndNonNull('server') && !options.value.noServer) {
+ throw new TypeError('`port` or a `server` must be provided');
+ }
+
+ var self = this;
+
+ if (options.isDefinedAndNonNull('port')) {
+ this._server = http.createServer(function (req, res) {
+ res.writeHead(200, {'Content-Type': 'text/plain'});
+ res.end('Not implemented');
+ });
+ this._server.listen(options.value.port, options.value.host, callback);
+ this._closeServer = function() { if (self._server) self._server.close(); };
+ }
+ else if (options.value.server) {
+ this._server = options.value.server;
+ if (options.value.path) {
+ // take note of the path, to avoid collisions when multiple websocket servers are
+ // listening on the same http server
+ if (this._server._webSocketPaths && options.value.server._webSocketPaths[options.value.path]) {
+ throw new Error('two instances of WebSocketServer cannot listen on the same http server path');
+ }
+ if (typeof this._server._webSocketPaths !== 'object') {
+ this._server._webSocketPaths = {};
+ }
+ this._server._webSocketPaths[options.value.path] = 1;
+ }
+ }
+ if (this._server) this._server.once('listening', function() { self.emit('listening'); });
+
+ if (typeof this._server != 'undefined') {
+ this._server.on('error', function(error) {
+ self.emit('error', error)
+ });
+ this._server.on('upgrade', function(req, socket, upgradeHead) {
+ //copy upgradeHead to avoid retention of large slab buffers used in node core
+ var head = new Buffer(upgradeHead.length);
+ upgradeHead.copy(head);
+
+ self.handleUpgrade(req, socket, head, function(client) {
+ self.emit('connection'+req.url, client);
+ self.emit('connection', client);
+ });
+ });
+ }
+
+ this.options = options.value;
+ this.path = options.value.path;
+ this.clients = [];
+}
+
+/**
+ * Inherits from EventEmitter.
+ */
+
+util.inherits(WebSocketServer, events.EventEmitter);
+
+/**
+ * Immediately shuts down the connection.
+ *
+ * @api public
+ */
+
+WebSocketServer.prototype.close = function() {
+ // terminate all associated clients
+ var error = null;
+ try {
+ for (var i = 0, l = this.clients.length; i < l; ++i) {
+ this.clients[i].terminate();
+ }
+ }
+ catch (e) {
+ error = e;
+ }
+
+ // remove path descriptor, if any
+ if (this.path && this._server._webSocketPaths) {
+ delete this._server._webSocketPaths[this.path];
+ if (Object.keys(this._server._webSocketPaths).length == 0) {
+ delete this._server._webSocketPaths;
+ }
+ }
+
+ // close the http server if it was internally created
+ try {
+ if (typeof this._closeServer !== 'undefined') {
+ this._closeServer();
+ }
+ }
+ finally {
+ delete this._server;
+ }
+ if (error) throw error;
+}
+
+/**
+ * Handle a HTTP Upgrade request.
+ *
+ * @api public
+ */
+
+WebSocketServer.prototype.handleUpgrade = function(req, socket, upgradeHead, cb) {
+ // check for wrong path
+ if (this.options.path) {
+ var u = url.parse(req.url);
+ if (u && u.pathname !== this.options.path) return;
+ }
+
+ if (typeof req.headers.upgrade === 'undefined' || req.headers.upgrade.toLowerCase() !== 'websocket') {
+ abortConnection(socket, 400, 'Bad Request');
+ return;
+ }
+
+ if (req.headers['sec-websocket-key1']) handleHixieUpgrade.apply(this, arguments);
+ else handleHybiUpgrade.apply(this, arguments);
+}
+
+module.exports = WebSocketServer;
+
+/**
+ * Entirely private apis,
+ * which may or may not be bound to a sepcific WebSocket instance.
+ */
+
+function handleHybiUpgrade(req, socket, upgradeHead, cb) {
+ // handle premature socket errors
+ var errorHandler = function() {
+ try { socket.destroy(); } catch (e) {}
+ }
+ socket.on('error', errorHandler);
+
+ // verify key presence
+ if (!req.headers['sec-websocket-key']) {
+ abortConnection(socket, 400, 'Bad Request');
+ return;
+ }
+
+ // verify version
+ var version = parseInt(req.headers['sec-websocket-version']);
+ if ([8, 13].indexOf(version) === -1) {
+ abortConnection(socket, 400, 'Bad Request');
+ return;
+ }
+
+ // verify protocol
+ var protocols = req.headers['sec-websocket-protocol'];
+
+ // verify client
+ var origin = version < 13 ?
+ req.headers['sec-websocket-origin'] :
+ req.headers['origin'];
+
+ // handler to call when the connection sequence completes
+ var self = this;
+ var completeHybiUpgrade2 = function(protocol) {
+
+ // calc key
+ var key = req.headers['sec-websocket-key'];
+ var shasum = crypto.createHash('sha1');
+ shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11");
+ key = shasum.digest('base64');
+
+ var headers = [
+ 'HTTP/1.1 101 Switching Protocols'
+ , 'Upgrade: websocket'
+ , 'Connection: Upgrade'
+ , 'Sec-WebSocket-Accept: ' + key
+ ];
+
+ if (typeof protocol != 'undefined') {
+ headers.push('Sec-WebSocket-Protocol: ' + protocol);
+ }
+
+ // allows external modification/inspection of handshake headers
+ self.emit('headers', headers);
+
+ socket.setTimeout(0);
+ socket.setNoDelay(true);
+ try {
+ socket.write(headers.concat('', '').join('\r\n'));
+ }
+ catch (e) {
+ // if the upgrade write fails, shut the connection down hard
+ try { socket.destroy(); } catch (e) {}
+ return;
+ }
+
+ var client = new WebSocket([req, socket, upgradeHead], {
+ protocolVersion: version,
+ protocol: protocol
+ });
+
+ if (self.options.clientTracking) {
+ self.clients.push(client);
+ client.on('close', function() {
+ var index = self.clients.indexOf(client);
+ if (index != -1) {
+ self.clients.splice(index, 1);
+ }
+ });
+ }
+
+ // signal upgrade complete
+ socket.removeListener('error', errorHandler);
+ cb(client);
+ }
+
+ // optionally call external protocol selection handler before
+ // calling completeHybiUpgrade2
+ var completeHybiUpgrade1 = function() {
+ // choose from the sub-protocols
+ if (typeof self.options.handleProtocols == 'function') {
+ var protList = (protocols || "").split(/, */);
+ var callbackCalled = false;
+ var res = self.options.handleProtocols(protList, function(result, protocol) {
+ callbackCalled = true;
+ if (!result) abortConnection(socket, 404, 'Unauthorized')
+ else completeHybiUpgrade2(protocol);
+ });
+ if (!callbackCalled) {
+ // the handleProtocols handler never called our callback
+ abortConnection(socket, 501, 'Could not process protocols');
+ }
+ return;
+ } else {
+ if (typeof protocols !== 'undefined') {
+ completeHybiUpgrade2(protocols.split(/, */)[0]);
+ }
+ else {
+ completeHybiUpgrade2();
+ }
+ }
+ }
+
+ // optionally call external client verification handler
+ if (typeof this.options.verifyClient == 'function') {
+ var info = {
+ origin: origin,
+ secure: typeof req.connection.authorized !== 'undefined' || typeof req.connection.encrypted !== 'undefined',
+ req: req
+ };
+ if (this.options.verifyClient.length == 2) {
+ this.options.verifyClient(info, function(result, code, name) {
+ if (typeof code === 'undefined') code = 401;
+ if (typeof name === 'undefined') name = http.STATUS_CODES[code];
+
+ if (!result) abortConnection(socket, code, name);
+ else completeHybiUpgrade1();
+ });
+ return;
+ }
+ else if (!this.options.verifyClient(info)) {
+ abortConnection(socket, 401, 'Unauthorized');
+ return;
+ }
+ }
+
+ completeHybiUpgrade1();
+}
+
+function handleHixieUpgrade(req, socket, upgradeHead, cb) {
+ // handle premature socket errors
+ var errorHandler = function() {
+ try { socket.destroy(); } catch (e) {}
+ }
+ socket.on('error', errorHandler);
+
+ // bail if options prevent hixie
+ if (this.options.disableHixie) {
+ abortConnection(socket, 401, 'Hixie support disabled');
+ return;
+ }
+
+ // verify key presence
+ if (!req.headers['sec-websocket-key2']) {
+ abortConnection(socket, 400, 'Bad Request');
+ return;
+ }
+
+ var origin = req.headers['origin']
+ , self = this;
+
+ // setup handshake completion to run after client has been verified
+ var onClientVerified = function() {
+ var wshost;
+ if (!req.headers['x-forwarded-host'])
+ wshost = req.headers.host;
+ else
+ wshost = req.headers['x-forwarded-host'];
+ var location = ((req.headers['x-forwarded-proto'] === 'https' || socket.encrypted) ? 'wss' : 'ws') + '://' + wshost + req.url
+ , protocol = req.headers['sec-websocket-protocol'];
+
+ // handshake completion code to run once nonce has been successfully retrieved
+ var completeHandshake = function(nonce, rest) {
+ // calculate key
+ var k1 = req.headers['sec-websocket-key1']
+ , k2 = req.headers['sec-websocket-key2']
+ , md5 = crypto.createHash('md5');
+
+ [k1, k2].forEach(function (k) {
+ var n = parseInt(k.replace(/[^\d]/g, ''))
+ , spaces = k.replace(/[^ ]/g, '').length;
+ if (spaces === 0 || n % spaces !== 0){
+ abortConnection(socket, 400, 'Bad Request');
+ return;
+ }
+ n /= spaces;
+ md5.update(String.fromCharCode(
+ n >> 24 & 0xFF,
+ n >> 16 & 0xFF,
+ n >> 8 & 0xFF,
+ n & 0xFF));
+ });
+ md5.update(nonce.toString('binary'));
+
+ var headers = [
+ 'HTTP/1.1 101 Switching Protocols'
+ , 'Upgrade: WebSocket'
+ , 'Connection: Upgrade'
+ , 'Sec-WebSocket-Location: ' + location
+ ];
+ if (typeof protocol != 'undefined') headers.push('Sec-WebSocket-Protocol: ' + protocol);
+ if (typeof origin != 'undefined') headers.push('Sec-WebSocket-Origin: ' + origin);
+
+ socket.setTimeout(0);
+ socket.setNoDelay(true);
+ try {
+ // merge header and hash buffer
+ var headerBuffer = new Buffer(headers.concat('', '').join('\r\n'));
+ var hashBuffer = new Buffer(md5.digest('binary'), 'binary');
+ var handshakeBuffer = new Buffer(headerBuffer.length + hashBuffer.length);
+ headerBuffer.copy(handshakeBuffer, 0);
+ hashBuffer.copy(handshakeBuffer, headerBuffer.length);
+
+ // do a single write, which - upon success - causes a new client websocket to be setup
+ socket.write(handshakeBuffer, 'binary', function(err) {
+ if (err) return; // do not create client if an error happens
+ var client = new WebSocket([req, socket, rest], {
+ protocolVersion: 'hixie-76',
+ protocol: protocol
+ });
+ if (self.options.clientTracking) {
+ self.clients.push(client);
+ client.on('close', function() {
+ var index = self.clients.indexOf(client);
+ if (index != -1) {
+ self.clients.splice(index, 1);
+ }
+ });
+ }
+
+ // signal upgrade complete
+ socket.removeListener('error', errorHandler);
+ cb(client);
+ });
+ }
+ catch (e) {
+ try { socket.destroy(); } catch (e) {}
+ return;
+ }
+ }
+
+ // retrieve nonce
+ var nonceLength = 8;
+ if (upgradeHead && upgradeHead.length >= nonceLength) {
+ var nonce = upgradeHead.slice(0, nonceLength);
+ var rest = upgradeHead.length > nonceLength ? upgradeHead.slice(nonceLength) : null;
+ completeHandshake.call(self, nonce, rest);
+ }
+ else {
+ // nonce not present in upgradeHead, so we must wait for enough data
+ // data to arrive before continuing
+ var nonce = new Buffer(nonceLength);
+ upgradeHead.copy(nonce, 0);
+ var received = upgradeHead.length;
+ var rest = null;
+ var handler = function (data) {
+ var toRead = Math.min(data.length, nonceLength - received);
+ if (toRead === 0) return;
+ data.copy(nonce, received, 0, toRead);
+ received += toRead;
+ if (received == nonceLength) {
+ socket.removeListener('data', handler);
+ if (toRead < data.length) rest = data.slice(toRead);
+ completeHandshake.call(self, nonce, rest);
+ }
+ }
+ socket.on('data', handler);
+ }
+ }
+
+ // verify client
+ if (typeof this.options.verifyClient == 'function') {
+ var info = {
+ origin: origin,
+ secure: typeof req.connection.authorized !== 'undefined' || typeof req.connection.encrypted !== 'undefined',
+ req: req
+ };
+ if (this.options.verifyClient.length == 2) {
+ var self = this;
+ this.options.verifyClient(info, function(result, code, name) {
+ if (typeof code === 'undefined') code = 401;
+ if (typeof name === 'undefined') name = http.STATUS_CODES[code];
+
+ if (!result) abortConnection(socket, code, name);
+ else onClientVerified.apply(self);
+ });
+ return;
+ }
+ else if (!this.options.verifyClient(info)) {
+ abortConnection(socket, 401, 'Unauthorized');
+ return;
+ }
+ }
+
+ // no client verification required
+ onClientVerified();
+}
+
+function abortConnection(socket, code, name) {
+ try {
+ var response = [
+ 'HTTP/1.1 ' + code + ' ' + name,
+ 'Content-type: text/html'
+ ];
+ socket.write(response.concat('', '').join('\r\n'));
+ }
+ catch (e) { /* ignore errors - we've aborted this connection */ }
+ finally {
+ // ensure that an early aborted connection is shut down completely
+ try { socket.destroy(); } catch (e) {}
+ }
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/browser.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/browser.js
new file mode 100644
index 0000000..8d3a755
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/lib/browser.js
@@ -0,0 +1,43 @@
+
+/**
+ * Module dependencies.
+ */
+
+var global = (function() { return this; })();
+
+/**
+ * WebSocket constructor.
+ */
+
+var WebSocket = global.WebSocket || global.MozWebSocket;
+
+/**
+ * Module exports.
+ */
+
+module.exports = WebSocket ? ws : null;
+
+/**
+ * WebSocket constructor.
+ *
+ * The third `opts` options object gets ignored in web browsers, since it's
+ * non-standard, and throws a TypeError if passed to the constructor.
+ * See: https://github.com/einaros/ws/issues/227
+ *
+ * @param {String} uri
+ * @param {Array} protocols (optional)
+ * @param {Object) opts (optional)
+ * @api public
+ */
+
+function ws(uri, protocols, opts) {
+ var instance;
+ if (protocols) {
+ instance = new WebSocket(uri, protocols);
+ } else {
+ instance = new WebSocket(uri);
+ }
+ return instance;
+}
+
+if (WebSocket) ws.prototype = WebSocket.prototype;
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/Readme.md b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/Readme.md
new file mode 100644
index 0000000..d164401
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/Readme.md
@@ -0,0 +1,195 @@
+# Commander.js
+
+ The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).
+
+ [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js)
+
+## Installation
+
+ $ npm install commander
+
+## Option parsing
+
+ Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
+
+```js
+#!/usr/bin/env node
+
+/**
+ * Module dependencies.
+ */
+
+var program = require('commander');
+
+program
+ .version('0.0.1')
+ .option('-p, --peppers', 'Add peppers')
+ .option('-P, --pineapple', 'Add pineapple')
+ .option('-b, --bbq', 'Add bbq sauce')
+ .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
+ .parse(process.argv);
+
+console.log('you ordered a pizza with:');
+if (program.peppers) console.log(' - peppers');
+if (program.pineapple) console.log(' - pineapple');
+if (program.bbq) console.log(' - bbq');
+console.log(' - %s cheese', program.cheese);
+```
+
+ Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
+
+## Automated --help
+
+ The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
+
+```
+ $ ./examples/pizza --help
+
+ Usage: pizza [options]
+
+ Options:
+
+ -V, --version output the version number
+ -p, --peppers Add peppers
+ -P, --pineapple Add pineapple
+ -b, --bbq Add bbq sauce
+ -c, --cheese <type> Add the specified type of cheese [marble]
+ -h, --help output usage information
+
+```
+
+## Coercion
+
+```js
+function range(val) {
+ return val.split('..').map(Number);
+}
+
+function list(val) {
+ return val.split(',');
+}
+
+program
+ .version('0.0.1')
+ .usage('[options] <file ...>')
+ .option('-i, --integer <n>', 'An integer argument', parseInt)
+ .option('-f, --float <n>', 'A float argument', parseFloat)
+ .option('-r, --range <a>..<b>', 'A range', range)
+ .option('-l, --list <items>', 'A list', list)
+ .option('-o, --optional [value]', 'An optional value')
+ .parse(process.argv);
+
+console.log(' int: %j', program.integer);
+console.log(' float: %j', program.float);
+console.log(' optional: %j', program.optional);
+program.range = program.range || [];
+console.log(' range: %j..%j', program.range[0], program.range[1]);
+console.log(' list: %j', program.list);
+console.log(' args: %j', program.args);
+```
+
+## Custom help
+
+ You can display arbitrary `-h, --help` information
+ by listening for "--help". Commander will automatically
+ exit once you are done so that the remainder of your program
+ does not execute causing undesired behaviours, for example
+ in the following executable "stuff" will not output when
+ `--help` is used.
+
+```js
+#!/usr/bin/env node
+
+/**
+ * Module dependencies.
+ */
+
+var program = require('../');
+
+function list(val) {
+ return val.split(',').map(Number);
+}
+
+program
+ .version('0.0.1')
+ .option('-f, --foo', 'enable some foo')
+ .option('-b, --bar', 'enable some bar')
+ .option('-B, --baz', 'enable some baz');
+
+// must be before .parse() since
+// node's emit() is immediate
+
+program.on('--help', function(){
+ console.log(' Examples:');
+ console.log('');
+ console.log(' $ custom-help --help');
+ console.log(' $ custom-help -h');
+ console.log('');
+});
+
+program.parse(process.argv);
+
+console.log('stuff');
+```
+
+yielding the following help output:
+
+```
+
+Usage: custom-help [options]
+
+Options:
+
+ -h, --help output usage information
+ -V, --version output the version number
+ -f, --foo enable some foo
+ -b, --bar enable some bar
+ -B, --baz enable some baz
+
+Examples:
+
+ $ custom-help --help
+ $ custom-help -h
+
+```
+
+## .outputHelp()
+
+ Output help information without exiting.
+
+## .help()
+
+ Output help information and exit immediately.
+
+## Links
+
+ - [API documentation](http://visionmedia.github.com/commander.js/)
+ - [ascii tables](https://github.com/LearnBoost/cli-table)
+ - [progress bars](https://github.com/visionmedia/node-progress)
+ - [more progress bars](https://github.com/substack/node-multimeter)
+ - [examples](https://github.com/visionmedia/commander.js/tree/master/examples)
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2011 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+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.
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/index.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/index.js
new file mode 100644
index 0000000..790a751
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/index.js
@@ -0,0 +1,851 @@
+
+/**
+ * Module dependencies.
+ */
+
+var EventEmitter = require('events').EventEmitter;
+var spawn = require('child_process').spawn;
+var fs = require('fs');
+var exists = fs.existsSync;
+var path = require('path');
+var dirname = path.dirname;
+var basename = path.basename;
+
+/**
+ * Expose the root command.
+ */
+
+exports = module.exports = new Command;
+
+/**
+ * Expose `Command`.
+ */
+
+exports.Command = Command;
+
+/**
+ * Expose `Option`.
+ */
+
+exports.Option = Option;
+
+/**
+ * Initialize a new `Option` with the given `flags` and `description`.
+ *
+ * @param {String} flags
+ * @param {String} description
+ * @api public
+ */
+
+function Option(flags, description) {
+ this.flags = flags;
+ this.required = ~flags.indexOf('<');
+ this.optional = ~flags.indexOf('[');
+ this.bool = !~flags.indexOf('-no-');
+ flags = flags.split(/[ ,|]+/);
+ if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
+ this.long = flags.shift();
+ this.description = description || '';
+}
+
+/**
+ * Return option name.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Option.prototype.name = function(){
+ return this.long
+ .replace('--', '')
+ .replace('no-', '');
+};
+
+/**
+ * Check if `arg` matches the short or long flag.
+ *
+ * @param {String} arg
+ * @return {Boolean}
+ * @api private
+ */
+
+Option.prototype.is = function(arg){
+ return arg == this.short
+ || arg == this.long;
+};
+
+/**
+ * Initialize a new `Command`.
+ *
+ * @param {String} name
+ * @api public
+ */
+
+function Command(name) {
+ this.commands = [];
+ this.options = [];
+ this._execs = [];
+ this._args = [];
+ this._name = name;
+}
+
+/**
+ * Inherit from `EventEmitter.prototype`.
+ */
+
+Command.prototype.__proto__ = EventEmitter.prototype;
+
+/**
+ * Add command `name`.
+ *
+ * The `.action()` callback is invoked when the
+ * command `name` is specified via __ARGV__,
+ * and the remaining arguments are applied to the
+ * function for access.
+ *
+ * When the `name` is "*" an un-matched command
+ * will be passed as the first arg, followed by
+ * the rest of __ARGV__ remaining.
+ *
+ * Examples:
+ *
+ * program
+ * .version('0.0.1')
+ * .option('-C, --chdir <path>', 'change the working directory')
+ * .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
+ * .option('-T, --no-tests', 'ignore test hook')
+ *
+ * program
+ * .command('setup')
+ * .description('run remote setup commands')
+ * .action(function(){
+ * console.log('setup');
+ * });
+ *
+ * program
+ * .command('exec <cmd>')
+ * .description('run the given remote command')
+ * .action(function(cmd){
+ * console.log('exec "%s"', cmd);
+ * });
+ *
+ * program
+ * .command('*')
+ * .description('deploy the given env')
+ * .action(function(env){
+ * console.log('deploying "%s"', env);
+ * });
+ *
+ * program.parse(process.argv);
+ *
+ * @param {String} name
+ * @param {String} [desc]
+ * @return {Command} the new command
+ * @api public
+ */
+
+Command.prototype.command = function(name, desc){
+ var args = name.split(/ +/);
+ var cmd = new Command(args.shift());
+ if (desc) cmd.description(desc);
+ if (desc) this.executables = true;
+ if (desc) this._execs[cmd._name] = true;
+ this.commands.push(cmd);
+ cmd.parseExpectedArgs(args);
+ cmd.parent = this;
+ if (desc) return this;
+ return cmd;
+};
+
+/**
+ * Add an implicit `help [cmd]` subcommand
+ * which invokes `--help` for the given command.
+ *
+ * @api private
+ */
+
+Command.prototype.addImplicitHelpCommand = function() {
+ this.command('help [cmd]', 'display help for [cmd]');
+};
+
+/**
+ * Parse expected `args`.
+ *
+ * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
+ *
+ * @param {Array} args
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.parseExpectedArgs = function(args){
+ if (!args.length) return;
+ var self = this;
+ args.forEach(function(arg){
+ switch (arg[0]) {
+ case '<':
+ self._args.push({ required: true, name: arg.slice(1, -1) });
+ break;
+ case '[':
+ self._args.push({ required: false, name: arg.slice(1, -1) });
+ break;
+ }
+ });
+ return this;
+};
+
+/**
+ * Register callback `fn` for the command.
+ *
+ * Examples:
+ *
+ * program
+ * .command('help')
+ * .description('display verbose help')
+ * .action(function(){
+ * // output help here
+ * });
+ *
+ * @param {Function} fn
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.action = function(fn){
+ var self = this;
+ this.parent.on(this._name, function(args, unknown){
+ // Parse any so-far unknown options
+ unknown = unknown || [];
+ var parsed = self.parseOptions(unknown);
+
+ // Output help if necessary
+ outputHelpIfNecessary(self, parsed.unknown);
+
+ // If there are still any unknown options, then we simply
+ // die, unless someone asked for help, in which case we give it
+ // to them, and then we die.
+ if (parsed.unknown.length > 0) {
+ self.unknownOption(parsed.unknown[0]);
+ }
+
+ // Leftover arguments need to be pushed back. Fixes issue #56
+ if (parsed.args.length) args = parsed.args.concat(args);
+
+ self._args.forEach(function(arg, i){
+ if (arg.required && null == args[i]) {
+ self.missingArgument(arg.name);
+ }
+ });
+
+ // Always append ourselves to the end of the arguments,
+ // to make sure we match the number of arguments the user
+ // expects
+ if (self._args.length) {
+ args[self._args.length] = self;
+ } else {
+ args.push(self);
+ }
+
+ fn.apply(this, args);
+ });
+ return this;
+};
+
+/**
+ * Define option with `flags`, `description` and optional
+ * coercion `fn`.
+ *
+ * The `flags` string should contain both the short and long flags,
+ * separated by comma, a pipe or space. The following are all valid
+ * all will output this way when `--help` is used.
+ *
+ * "-p, --pepper"
+ * "-p|--pepper"
+ * "-p --pepper"
+ *
+ * Examples:
+ *
+ * // simple boolean defaulting to false
+ * program.option('-p, --pepper', 'add pepper');
+ *
+ * --pepper
+ * program.pepper
+ * // => Boolean
+ *
+ * // simple boolean defaulting to false
+ * program.option('-C, --no-cheese', 'remove cheese');
+ *
+ * program.cheese
+ * // => true
+ *
+ * --no-cheese
+ * program.cheese
+ * // => true
+ *
+ * // required argument
+ * program.option('-C, --chdir <path>', 'change the working directory');
+ *
+ * --chdir /tmp
+ * program.chdir
+ * // => "/tmp"
+ *
+ * // optional argument
+ * program.option('-c, --cheese [type]', 'add cheese [marble]');
+ *
+ * @param {String} flags
+ * @param {String} description
+ * @param {Function|Mixed} fn or default
+ * @param {Mixed} defaultValue
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.option = function(flags, description, fn, defaultValue){
+ var self = this
+ , option = new Option(flags, description)
+ , oname = option.name()
+ , name = camelcase(oname);
+
+ // default as 3rd arg
+ if ('function' != typeof fn) defaultValue = fn, fn = null;
+
+ // preassign default value only for --no-*, [optional], or <required>
+ if (false == option.bool || option.optional || option.required) {
+ // when --no-* we make sure default is true
+ if (false == option.bool) defaultValue = true;
+ // preassign only if we have a default
+ if (undefined !== defaultValue) self[name] = defaultValue;
+ }
+
+ // register the option
+ this.options.push(option);
+
+ // when it's passed assign the value
+ // and conditionally invoke the callback
+ this.on(oname, function(val){
+ // coercion
+ if (null != val && fn) val = fn(val);
+
+ // unassigned or bool
+ if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) {
+ // if no value, bool true, and we have a default, then use it!
+ if (null == val) {
+ self[name] = option.bool
+ ? defaultValue || true
+ : false;
+ } else {
+ self[name] = val;
+ }
+ } else if (null !== val) {
+ // reassign
+ self[name] = val;
+ }
+ });
+
+ return this;
+};
+
+/**
+ * Parse `argv`, settings options and invoking commands when defined.
+ *
+ * @param {Array} argv
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.parse = function(argv){
+ // implicit help
+ if (this.executables) this.addImplicitHelpCommand();
+
+ // store raw args
+ this.rawArgs = argv;
+
+ // guess name
+ this._name = this._name || basename(argv[1]);
+
+ // process argv
+ var parsed = this.parseOptions(this.normalize(argv.slice(2)));
+ var args = this.args = parsed.args;
+
+ var result = this.parseArgs(this.args, parsed.unknown);
+
+ // executable sub-commands
+ var name = result.args[0];
+ if (this._execs[name]) return this.executeSubCommand(argv, args, parsed.unknown);
+
+ return result;
+};
+
+/**
+ * Execute a sub-command executable.
+ *
+ * @param {Array} argv
+ * @param {Array} args
+ * @param {Array} unknown
+ * @api private
+ */
+
+Command.prototype.executeSubCommand = function(argv, args, unknown) {
+ args = args.concat(unknown);
+
+ if (!args.length) this.help();
+ if ('help' == args[0] && 1 == args.length) this.help();
+
+ // <cmd> --help
+ if ('help' == args[0]) {
+ args[0] = args[1];
+ args[1] = '--help';
+ }
+
+ // executable
+ var dir = dirname(argv[1]);
+ var bin = basename(argv[1]) + '-' + args[0];
+
+ // check for ./<bin> first
+ var local = path.join(dir, bin);
+
+ // run it
+ args = args.slice(1);
+ var proc = spawn(local, args, { stdio: 'inherit', customFds: [0, 1, 2] });
+ proc.on('error', function(err){
+ if (err.code == "ENOENT") {
+ console.error('\n %s(1) does not exist, try --help\n', bin);
+ } else if (err.code == "EACCES") {
+ console.error('\n %s(1) not executable. try chmod or run with root\n', bin);
+ }
+ });
+
+ this.runningCommand = proc;
+};
+
+/**
+ * Normalize `args`, splitting joined short flags. For example
+ * the arg "-abc" is equivalent to "-a -b -c".
+ * This also normalizes equal sign and splits "--abc=def" into "--abc def".
+ *
+ * @param {Array} args
+ * @return {Array}
+ * @api private
+ */
+
+Command.prototype.normalize = function(args){
+ var ret = []
+ , arg
+ , lastOpt
+ , index;
+
+ for (var i = 0, len = args.length; i < len; ++i) {
+ arg = args[i];
+ i > 0 && (lastOpt = this.optionFor(args[i-1]));
+
+ if (lastOpt && lastOpt.required) {
+ ret.push(arg);
+ } else if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) {
+ arg.slice(1).split('').forEach(function(c){
+ ret.push('-' + c);
+ });
+ } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) {
+ ret.push(arg.slice(0, index), arg.slice(index + 1));
+ } else {
+ ret.push(arg);
+ }
+ }
+
+ return ret;
+};
+
+/**
+ * Parse command `args`.
+ *
+ * When listener(s) are available those
+ * callbacks are invoked, otherwise the "*"
+ * event is emitted and those actions are invoked.
+ *
+ * @param {Array} args
+ * @return {Command} for chaining
+ * @api private
+ */
+
+Command.prototype.parseArgs = function(args, unknown){
+ var cmds = this.commands
+ , len = cmds.length
+ , name;
+
+ if (args.length) {
+ name = args[0];
+ if (this.listeners(name).length) {
+ this.emit(args.shift(), args, unknown);
+ } else {
+ this.emit('*', args);
+ }
+ } else {
+ outputHelpIfNecessary(this, unknown);
+
+ // If there were no args and we have unknown options,
+ // then they are extraneous and we need to error.
+ if (unknown.length > 0) {
+ this.unknownOption(unknown[0]);
+ }
+ }
+
+ return this;
+};
+
+/**
+ * Return an option matching `arg` if any.
+ *
+ * @param {String} arg
+ * @return {Option}
+ * @api private
+ */
+
+Command.prototype.optionFor = function(arg){
+ for (var i = 0, len = this.options.length; i < len; ++i) {
+ if (this.options[i].is(arg)) {
+ return this.options[i];
+ }
+ }
+};
+
+/**
+ * Parse options from `argv` returning `argv`
+ * void of these options.
+ *
+ * @param {Array} argv
+ * @return {Array}
+ * @api public
+ */
+
+Command.prototype.parseOptions = function(argv){
+ var args = []
+ , len = argv.length
+ , literal
+ , option
+ , arg;
+
+ var unknownOptions = [];
+
+ // parse options
+ for (var i = 0; i < len; ++i) {
+ arg = argv[i];
+
+ // literal args after --
+ if ('--' == arg) {
+ literal = true;
+ continue;
+ }
+
+ if (literal) {
+ args.push(arg);
+ continue;
+ }
+
+ // find matching Option
+ option = this.optionFor(arg);
+
+ // option is defined
+ if (option) {
+ // requires arg
+ if (option.required) {
+ arg = argv[++i];
+ if (null == arg) return this.optionMissingArgument(option);
+ this.emit(option.name(), arg);
+ // optional arg
+ } else if (option.optional) {
+ arg = argv[i+1];
+ if (null == arg || ('-' == arg[0] && '-' != arg)) {
+ arg = null;
+ } else {
+ ++i;
+ }
+ this.emit(option.name(), arg);
+ // bool
+ } else {
+ this.emit(option.name());
+ }
+ continue;
+ }
+
+ // looks like an option
+ if (arg.length > 1 && '-' == arg[0]) {
+ unknownOptions.push(arg);
+
+ // If the next argument looks like it might be
+ // an argument for this option, we pass it on.
+ // If it isn't, then it'll simply be ignored
+ if (argv[i+1] && '-' != argv[i+1][0]) {
+ unknownOptions.push(argv[++i]);
+ }
+ continue;
+ }
+
+ // arg
+ args.push(arg);
+ }
+
+ return { args: args, unknown: unknownOptions };
+};
+
+/**
+ * Argument `name` is missing.
+ *
+ * @param {String} name
+ * @api private
+ */
+
+Command.prototype.missingArgument = function(name){
+ console.error();
+ console.error(" error: missing required argument `%s'", name);
+ console.error();
+ process.exit(1);
+};
+
+/**
+ * `Option` is missing an argument, but received `flag` or nothing.
+ *
+ * @param {String} option
+ * @param {String} flag
+ * @api private
+ */
+
+Command.prototype.optionMissingArgument = function(option, flag){
+ console.error();
+ if (flag) {
+ console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag);
+ } else {
+ console.error(" error: option `%s' argument missing", option.flags);
+ }
+ console.error();
+ process.exit(1);
+};
+
+/**
+ * Unknown option `flag`.
+ *
+ * @param {String} flag
+ * @api private
+ */
+
+Command.prototype.unknownOption = function(flag){
+ console.error();
+ console.error(" error: unknown option `%s'", flag);
+ console.error();
+ process.exit(1);
+};
+
+
+/**
+ * Set the program version to `str`.
+ *
+ * This method auto-registers the "-V, --version" flag
+ * which will print the version number when passed.
+ *
+ * @param {String} str
+ * @param {String} flags
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.version = function(str, flags){
+ if (0 == arguments.length) return this._version;
+ this._version = str;
+ flags = flags || '-V, --version';
+ this.option(flags, 'output the version number');
+ this.on('version', function(){
+ console.log(str);
+ process.exit(0);
+ });
+ return this;
+};
+
+/**
+ * Set the description `str`.
+ *
+ * @param {String} str
+ * @return {String|Command}
+ * @api public
+ */
+
+Command.prototype.description = function(str){
+ if (0 == arguments.length) return this._description;
+ this._description = str;
+ return this;
+};
+
+/**
+ * Set / get the command usage `str`.
+ *
+ * @param {String} str
+ * @return {String|Command}
+ * @api public
+ */
+
+Command.prototype.usage = function(str){
+ var args = this._args.map(function(arg){
+ return arg.required
+ ? '<' + arg.name + '>'
+ : '[' + arg.name + ']';
+ });
+
+ var usage = '[options'
+ + (this.commands.length ? '] [command' : '')
+ + ']'
+ + (this._args.length ? ' ' + args : '');
+
+ if (0 == arguments.length) return this._usage || usage;
+ this._usage = str;
+
+ return this;
+};
+
+/**
+ * Return the largest option length.
+ *
+ * @return {Number}
+ * @api private
+ */
+
+Command.prototype.largestOptionLength = function(){
+ return this.options.reduce(function(max, option){
+ return Math.max(max, option.flags.length);
+ }, 0);
+};
+
+/**
+ * Return help for options.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.optionHelp = function(){
+ var width = this.largestOptionLength();
+
+ // Prepend the help information
+ return [pad('-h, --help', width) + ' ' + 'output usage information']
+ .concat(this.options.map(function(option){
+ return pad(option.flags, width)
+ + ' ' + option.description;
+ }))
+ .join('\n');
+};
+
+/**
+ * Return command help documentation.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.commandHelp = function(){
+ if (!this.commands.length) return '';
+ return [
+ ''
+ , ' Commands:'
+ , ''
+ , this.commands.map(function(cmd){
+ var args = cmd._args.map(function(arg){
+ return arg.required
+ ? '<' + arg.name + '>'
+ : '[' + arg.name + ']';
+ }).join(' ');
+
+ return pad(cmd._name
+ + (cmd.options.length
+ ? ' [options]'
+ : '') + ' ' + args, 22)
+ + (cmd.description()
+ ? ' ' + cmd.description()
+ : '');
+ }).join('\n').replace(/^/gm, ' ')
+ , ''
+ ].join('\n');
+};
+
+/**
+ * Return program help documentation.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.helpInformation = function(){
+ return [
+ ''
+ , ' Usage: ' + this._name + ' ' + this.usage()
+ , '' + this.commandHelp()
+ , ' Options:'
+ , ''
+ , '' + this.optionHelp().replace(/^/gm, ' ')
+ , ''
+ , ''
+ ].join('\n');
+};
+
+/**
+ * Output help information for this command
+ *
+ * @api public
+ */
+
+Command.prototype.outputHelp = function(){
+ process.stdout.write(this.helpInformation());
+ this.emit('--help');
+};
+
+/**
+ * Output help information and exit.
+ *
+ * @api public
+ */
+
+Command.prototype.help = function(){
+ this.outputHelp();
+ process.exit();
+};
+
+/**
+ * Camel-case the given `flag`
+ *
+ * @param {String} flag
+ * @return {String}
+ * @api private
+ */
+
+function camelcase(flag) {
+ return flag.split('-').reduce(function(str, word){
+ return str + word[0].toUpperCase() + word.slice(1);
+ });
+}
+
+/**
+ * Pad `str` to `width`.
+ *
+ * @param {String} str
+ * @param {Number} width
+ * @return {String}
+ * @api private
+ */
+
+function pad(str, width) {
+ var len = Math.max(0, width - str.length);
+ return str + Array(len + 1).join(' ');
+}
+
+/**
+ * Output help information if necessary
+ *
+ * @param {Command} command to output help for
+ * @param {Array} array of options to search for -h or --help
+ * @api private
+ */
+
+function outputHelpIfNecessary(cmd, options) {
+ options = options || [];
+ for (var i = 0; i < options.length; i++) {
+ if (options[i] == '--help' || options[i] == '-h') {
+ cmd.outputHelp();
+ process.exit(0);
+ }
+ }
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/package.json b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/package.json
new file mode 100644
index 0000000..7f046f1
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/commander/package.json
@@ -0,0 +1,57 @@
+{
+ "name": "commander",
+ "version": "2.1.0",
+ "description": "the complete solution for node.js command-line programs",
+ "keywords": [
+ "command",
+ "option",
+ "parser",
+ "prompt",
+ "stdin"
+ ],
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/visionmedia/commander.js.git"
+ },
+ "devDependencies": {
+ "should": ">= 0.0.1"
+ },
+ "scripts": {
+ "test": "make test"
+ },
+ "main": "index",
+ "engines": {
+ "node": ">= 0.6.x"
+ },
+ "files": [
+ "index.js"
+ ],
+ "bugs": {
+ "url": "https://github.com/visionmedia/commander.js/issues"
+ },
+ "homepage": "https://github.com/visionmedia/commander.js",
+ "_id": "commander@2.1.0",
+ "dist": {
+ "shasum": "d121bbae860d9992a3d517ba96f56588e47c6781",
+ "tarball": "http://registry.npmjs.org/commander/-/commander-2.1.0.tgz"
+ },
+ "_from": "commander@~2.1.0",
+ "_npmVersion": "1.3.14",
+ "_npmUser": {
+ "name": "tjholowaychuk",
+ "email": "tj@vision-media.ca"
+ },
+ "maintainers": [
+ {
+ "name": "tjholowaychuk",
+ "email": "tj@vision-media.ca"
+ }
+ ],
+ "directories": {},
+ "_shasum": "d121bbae860d9992a3d517ba96f56588e47c6781",
+ "_resolved": "https://registry.npmjs.org/commander/-/commander-2.1.0.tgz"
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/.dntrc b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/.dntrc
new file mode 100644
index 0000000..1c3e624
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/.dntrc
@@ -0,0 +1,36 @@
+## DNT config file
+## see https://github.com/rvagg/dnt
+
+NODE_VERSIONS="\
+ master \
+ v0.11.13 \
+ v0.11.10 \
+ v0.11.9 \
+ v0.11.8 \
+ v0.11.7 \
+ v0.11.6 \
+ v0.11.5 \
+ v0.11.4 \
+ v0.10.26 \
+ v0.10.25 \
+ v0.10.24 \
+ v0.10.23 \
+ v0.10.22 \
+ v0.10.21 \
+ v0.10.20 \
+ v0.10.19 \
+ v0.10.18 \
+ v0.8.26 \
+ v0.8.25 \
+ v0.8.24 \
+ v0.8.23 \
+ v0.8.22 \
+"
+OUTPUT_PREFIX="nan-"
+TEST_CMD="\
+ cd /dnt/test/ && \
+ npm install && \
+ node_modules/.bin/node-gyp --nodedir /usr/src/node/ rebuild && \
+ node_modules/.bin/tap --gc js/*-test.js; \
+"
+
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/LICENSE b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/LICENSE
new file mode 100644
index 0000000..d502e18
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/LICENSE
@@ -0,0 +1,46 @@
+Copyright 2013, NAN contributors:
+ - Rod Vagg <https://github.com/rvagg>
+ - Benjamin Byholm <https://github.com/kkoopa>
+ - Trevor Norris <https://github.com/trevnorris>
+ - Nathan Rajlich <https://github.com/TooTallNate>
+ - Brett Lawson <https://github.com/brett19>
+ - Ben Noordhuis <https://github.com/bnoordhuis>
+(the "Original Author")
+All rights reserved.
+
+MIT +no-false-attribs License
+
+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.
+
+Distributions of all or part of the Software intended to be used
+by the recipients as they would use the unmodified Software,
+containing modifications that substantially alter, remove, or
+disable functionality of the Software, outside of the documented
+configuration mechanisms provided by the Software, shall be
+modified such that the Original Author's bug reporting email
+addresses and urls are either replaced with the contact information
+of the parties responsible for the changes, or removed entirely.
+
+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.
+
+
+Except where noted, this license applies to any and all software
+programs and associated documentation files created by the
+Original Author, when distributed with the Software.
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/README.md b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/README.md
new file mode 100644
index 0000000..7c8d688
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/README.md
@@ -0,0 +1,947 @@
+Native Abstractions for Node.js
+===============================
+
+**A header file filled with macro and utility goodness for making add-on development for Node.js easier across versions 0.8, 0.10 and 0.11, and eventually 0.12.**
+
+***Current version: 1.0.0*** *(See [nan.h](https://github.com/rvagg/nan/blob/master/nan.h) for complete ChangeLog)*
+
+[![NPM](https://nodei.co/npm/nan.png?downloads=true)](https://nodei.co/npm/nan/) [![NPM](https://nodei.co/npm-dl/nan.png?months=6)](https://nodei.co/npm/nan/)
+
+Thanks to the crazy changes in V8 (and some in Node core), keeping native addons compiling happily across versions, particularly 0.10 to 0.11/0.12, is a minor nightmare. The goal of this project is to store all logic necessary to develop native Node.js addons without having to inspect `NODE_MODULE_VERSION` and get yourself into a macro-tangle.
+
+This project also contains some helper utilities that make addon development a bit more pleasant.
+
+ * **[News & Updates](#news)**
+ * **[Usage](#usage)**
+ * **[Example](#example)**
+ * **[API](#api)**
+
+<a name="news"></a>
+## News & Updates
+
+### May-2013: Major changes for V8 3.25 / Node 0.11.13
+
+Node 0.11.11 and 0.11.12 were both broken releases for native add-ons, you simply can't properly compile against either of them for different reasons. But we now have a 0.11.13 release that jumps a couple of versions of V8 ahead and includes some more, major (traumatic) API changes.
+
+Because we are now nearing Node 0.12 and estimate that the version of V8 we are using in Node 0.11.13 will be close to the API we get for 0.12, we have taken the opportunity to not only *fix* NAN for 0.11.13 but make some major changes to improve the NAN API.
+
+We have **removed support for Node 0.11 versions prior to 0.11.13**, (although our tests are still passing for 0.11.10). As usual, our tests are run against (and pass) the last 5 versions of Node 0.8 and Node 0.10. We also include Node 0.11.13 obviously.
+
+The major change is something that [Benjamin Byholm](kkoopa) has put many hours in to. We now have a fantastic new `NanNew<T>(args)` interface for creating new `Local`s, this replaces `NanNewLocal()` and much more. If you look in [./nan.h](nan.h) you'll see a large number of overloaded versions of this method. In general you should be able to `NanNew<Type>(arguments)` for any type you want to make a `Local` from. This includes `Persistent` types, so we now have a `Local<T> NanNew(const Persistent<T> arg)` to replace `NanPersistentToLocal()`.
+
+We also now have `NanUndefined()`, `NanNull()`, `NanTrue()` and `NanFalse()`. Mainly because of the new requirement for an `Isolate` argument for each of the native V8 versions of this.
+
+V8 has now introduced an `EscapableHandleScope` from which you `scope.Escape(Local<T> value)` to *return* a value from a one scope to another. This replaces the standard `HandleScope` and `scope.Close(Local<T> value)`, although `HandleScope` still exists for when you don't need to return a handle to the caller. For NAN we are exposing it as `NanEscapableScope()` and `NanEscapeScope()`, while `NanScope()` is still how you create a new scope that doesn't need to return handles. For older versions of Node/V8, it'll still map to the older `HandleScope` functionality.
+
+`NanFromV8String()` was deprecated and has now been removed. You should use `NanCString()` or `NanRawString()` instead.
+
+Because `node::MakeCallback()` now takes an `Isolate`, and because it doesn't exist in older versions of Node, we've introduced `NanMakeCallabck()`. You should *always* use this when calling a JavaScript function from C++.
+
+There's lots more, check out the Changelog in nan.h or look through [#86](https://github.com/rvagg/nan/pull/86) for all the gory details.
+
+### Dec-2013: NanCString and NanRawString
+
+Two new functions have been introduced to replace the functionality that's been provided by `NanFromV8String` until now. NanCString has sensible defaults so it's super easy to fetch a null-terminated c-style string out of a `v8::String`. `NanFromV8String` is still around and has defaults that allow you to pass a single handle to fetch a `char*` while `NanRawString` requires a little more attention to arguments.
+
+### Nov-2013: Node 0.11.9+ breaking V8 change
+
+The version of V8 that's shipping with Node 0.11.9+ has changed the signature for new `Local`s to: `v8::Local<T>::New(isolate, value)`, i.e. introducing the `isolate` argument and therefore breaking all new `Local` declarations for previous versions. NAN 0.6+ now includes a `NanNewLocal<T>(value)` that can be used in place to work around this incompatibility and maintain compatibility with 0.8->0.11.9+ (minus a few early 0.11 releases).
+
+For example, if you wanted to return a `null` on a callback you will have to change the argument from `v8::Local<v8::Value>::New(v8::Null())` to `NanNewLocal<v8::Value>(v8::Null())`.
+
+### Nov-2013: Change to binding.gyp `"include_dirs"` for NAN
+
+Inclusion of NAN in a project's binding.gyp is now greatly simplified. You can now just use `"<!(node -e \"require('nan')\")"` in your `"include_dirs"`, see example below (note Windows needs the quoting around `require` to be just right: `"require('nan')"` with appropriate `\` escaping).
+
+<a name="usage"></a>
+## Usage
+
+Simply add **NAN** as a dependency in the *package.json* of your Node addon:
+
+``` bash
+$ npm install --save nan
+```
+
+Pull in the path to **NAN** in your *binding.gyp* so that you can use `#include <nan.h>` in your *.cpp* files:
+
+``` python
+"include_dirs" : [
+ "<!(node -e \"require('nan')\")"
+]
+```
+
+This works like a `-I<path-to-NAN>` when compiling your addon.
+
+<a name="example"></a>
+## Example
+
+See **[LevelDOWN](https://github.com/rvagg/node-leveldown/pull/48)** for a full example of **NAN** in use.
+
+For a simpler example, see the **[async pi estimation example](https://github.com/rvagg/nan/tree/master/examples/async_pi_estimate)** in the examples directory for full code and an explanation of what this Monte Carlo Pi estimation example does. Below are just some parts of the full example that illustrate the use of **NAN**.
+
+Compare to the current 0.10 version of this example, found in the [node-addon-examples](https://github.com/rvagg/node-addon-examples/tree/master/9_async_work) repository and also a 0.11 version of the same found [here](https://github.com/kkoopa/node-addon-examples/tree/5c01f58fc993377a567812597e54a83af69686d7/9_async_work).
+
+Note that there is no embedded version sniffing going on here and also the async work is made much simpler, see below for details on the `NanAsyncWorker` class.
+
+```c++
+// addon.cc
+#include <node.h>
+#include <nan.h>
+// ...
+
+using v8::FunctionTemplate;
+using v8::Handle;
+using v8::Object;
+
+void InitAll(Handle<Object> exports) {
+ exports->Set(NanSymbol("calculateSync"),
+ NanNew<FunctionTemplate>(CalculateSync)->GetFunction());
+
+ exports->Set(NanSymbol("calculateAsync"),
+ NanNew<FunctionTemplate>(CalculateAsync)->GetFunction());
+}
+
+NODE_MODULE(addon, InitAll)
+```
+
+```c++
+// sync.h
+#include <node.h>
+#include <nan.h>
+
+NAN_METHOD(CalculateSync);
+```
+
+```c++
+// sync.cc
+#include <node.h>
+#include <nan.h>
+#include "./sync.h"
+// ...
+
+using v8::Number;
+
+// Simple synchronous access to the `Estimate()` function
+NAN_METHOD(CalculateSync) {
+ NanScope();
+
+ // expect a number as the first argument
+ int points = args[0]->Uint32Value();
+ double est = Estimate(points);
+
+ NanReturnValue(NanNew<Number>(est));
+}
+```
+
+```c++
+// async.cc
+#include <node.h>
+#include <nan.h>
+#include "./async.h"
+
+// ...
+
+using v8::Function;
+using v8::Local;
+using v8::Null;
+using v8::Number;
+using v8::Value;
+
+class PiWorker : public NanAsyncWorker {
+ public:
+ PiWorker(NanCallback *callback, int points)
+ : NanAsyncWorker(callback), points(points) {}
+ ~PiWorker() {}
+
+ // Executed inside the worker-thread.
+ // It is not safe to access V8, or V8 data structures
+ // here, so everything we need for input and output
+ // should go on `this`.
+ void Execute () {
+ estimate = Estimate(points);
+ }
+
+ // Executed when the async work is complete
+ // this function will be run inside the main event loop
+ // so it is safe to use V8 again
+ void HandleOKCallback () {
+ NanScope();
+
+ Local<Value> argv[] = {
+ NanNew(NanNull())
+ , NanNew<Number>(estimate)
+ };
+
+ callback->Call(2, argv);
+ };
+
+ private:
+ int points;
+ double estimate;
+};
+
+// Asynchronous access to the `Estimate()` function
+NAN_METHOD(CalculateAsync) {
+ NanScope();
+
+ int points = args[0]->Uint32Value();
+ NanCallback *callback = new NanCallback(args[1].As<Function>());
+
+ NanAsyncQueueWorker(new PiWorker(callback, points));
+ NanReturnUndefined();
+}
+```
+
+<a name="api"></a>
+## API
+
+ * <a href="#api_nan_method"><b><code>NAN_METHOD</code></b></a>
+ * <a href="#api_nan_getter"><b><code>NAN_GETTER</code></b></a>
+ * <a href="#api_nan_setter"><b><code>NAN_SETTER</code></b></a>
+ * <a href="#api_nan_property_getter"><b><code>NAN_PROPERTY_GETTER</code></b></a>
+ * <a href="#api_nan_property_setter"><b><code>NAN_PROPERTY_SETTER</code></b></a>
+ * <a href="#api_nan_property_enumerator"><b><code>NAN_PROPERTY_ENUMERATOR</code></b></a>
+ * <a href="#api_nan_property_deleter"><b><code>NAN_PROPERTY_DELETER</code></b></a>
+ * <a href="#api_nan_property_query"><b><code>NAN_PROPERTY_QUERY</code></b></a>
+ * <a href="#api_nan_index_getter"><b><code>NAN_INDEX_GETTER</code></b></a>
+ * <a href="#api_nan_index_setter"><b><code>NAN_INDEX_SETTER</code></b></a>
+ * <a href="#api_nan_index_enumerator"><b><code>NAN_INDEX_ENUMERATOR</code></b></a>
+ * <a href="#api_nan_index_deleter"><b><code>NAN_INDEX_DELETER</code></b></a>
+ * <a href="#api_nan_index_query"><b><code>NAN_INDEX_QUERY</code></b></a>
+ * <a href="#api_nan_weak_callback"><b><code>NAN_WEAK_CALLBACK</code></b></a>
+ * <a href="#api_nan_deprecated"><b><code>NAN_DEPRECATED</code></b></a>
+ * <a href="#api_nan_inline"><b><code>NAN_INLINE</code></b></a>
+ * <a href="#api_nan_new"><b><code>NanNew</code></b></a>
+ * <a href="#api_nan_undefined"><b><code>NanUndefined</code></b></a>
+ * <a href="#api_nan_null"><b><code>NanNull</code></b></a>
+ * <a href="#api_nan_true"><b><code>NanTrue</code></b></a>
+ * <a href="#api_nan_false"><b><code>NanFalse</code></b></a>
+ * <a href="#api_nan_return_value"><b><code>NanReturnValue</code></b></a>
+ * <a href="#api_nan_return_undefined"><b><code>NanReturnUndefined</code></b></a>
+ * <a href="#api_nan_return_null"><b><code>NanReturnNull</code></b></a>
+ * <a href="#api_nan_return_empty_string"><b><code>NanReturnEmptyString</code></b></a>
+ * <a href="#api_nan_scope"><b><code>NanScope</code></b></a>
+ * <a href="#api_nan_escapable_scope"><b><code>NanEscapableScope</code></b></a>
+ * <a href="#api_nan_escape_scope"><b><code>NanEscapeScope</code></b></a>
+ * <a href="#api_nan_locker"><b><code>NanLocker</code></b></a>
+ * <a href="#api_nan_unlocker"><b><code>NanUnlocker</code></b></a>
+ * <a href="#api_nan_get_internal_field_pointer"><b><code>NanGetInternalFieldPointer</code></b></a>
+ * <a href="#api_nan_set_internal_field_pointer"><b><code>NanSetInternalFieldPointer</code></b></a>
+ * <a href="#api_nan_object_wrap_handle"><b><code>NanObjectWrapHandle</code></b></a>
+ * <a href="#api_nan_symbol"><b><code>NanSymbol</code></b></a>
+ * <a href="#api_nan_get_pointer_safe"><b><code>NanGetPointerSafe</code></b></a>
+ * <a href="#api_nan_set_pointer_safe"><b><code>NanSetPointerSafe</code></b></a>
+ * <a href="#api_nan_raw_string"><b><code>NanRawString</code></b></a>
+ * <a href="#api_nan_c_string"><b><code>NanCString</code></b></a>
+ * <a href="#api_nan_boolean_option_value"><b><code>NanBooleanOptionValue</code></b></a>
+ * <a href="#api_nan_uint32_option_value"><b><code>NanUInt32OptionValue</code></b></a>
+ * <a href="#api_nan_error"><b><code>NanError</code></b>, <b><code>NanTypeError</code></b>, <b><code>NanRangeError</code></b></a>
+ * <a href="#api_nan_throw_error"><b><code>NanThrowError</code></b>, <b><code>NanThrowTypeError</code></b>, <b><code>NanThrowRangeError</code></b>, <b><code>NanThrowError(Handle<Value>)</code></b>, <b><code>NanThrowError(Handle<Value>, int)</code></b></a>
+ * <a href="#api_nan_new_buffer_handle"><b><code>NanNewBufferHandle(char *, size_t, FreeCallback, void *)</code></b>, <b><code>NanNewBufferHandle(char *, uint32_t)</code></b>, <b><code>NanNewBufferHandle(uint32_t)</code></b></a>
+ * <a href="#api_nan_buffer_use"><b><code>NanBufferUse(char *, uint32_t)</code></b></a>
+ * <a href="#api_nan_new_context_handle"><b><code>NanNewContextHandle</code></b></a>
+ * <a href="#api_nan_get_current_context"><b><code>NanGetCurrentContext</code></b></a>
+ * <a href="#api_nan_has_instance"><b><code>NanHasInstance</code></b></a>
+ * <a href="#api_nan_dispose_persistent"><b><code>NanDisposePersistent</code></b></a>
+ * <a href="#api_nan_assign_persistent"><b><code>NanAssignPersistent</code></b></a>
+ * <a href="#api_nan_make_weak_persistent"><b><code>NanMakeWeakPersistent</code></b></a>
+ * <a href="#api_nan_set_template"><b><code>NanSetTemplate</code></b></a>
+ * <a href="#api_nan_make_callback"><b><code>NanMakeCallback</code></b></a>
+ * <a href="#api_nan_compile_script"><b><code>NanCompileScript</code></b></a>
+ * <a href="#api_nan_run_script"><b><code>NanRunScript</code></b></a>
+ * <a href="#api_nan_adjust_external_memory"><b><code>NanAdjustExternalMemory</code></b></a>
+ * <a href="#api_nan_add_gc_epilogue_callback"><b><code>NanAddGCEpilogueCallback</code></b></a>
+ * <a href="#api_nan_add_gc_prologue_callback"><b><code>NanAddGCPrologueCallback</code></b></a>
+ * <a href="#api_nan_remove_gc_epilogue_callback"><b><code>NanRemoveGCEpilogueCallback</code></b></a>
+ * <a href="#api_nan_remove_gc_prologue_callback"><b><code>NanRemoveGCPrologueCallback</code></b></a>
+ * <a href="#api_nan_get_heap_statistics"><b><code>NanGetHeapStatistics</code></b></a>
+ * <a href="#api_nan_callback"><b><code>NanCallback</code></b></a>
+ * <a href="#api_nan_async_worker"><b><code>NanAsyncWorker</code></b></a>
+ * <a href="#api_nan_async_queue_worker"><b><code>NanAsyncQueueWorker</code></b></a>
+
+<a name="api_nan_method"></a>
+### NAN_METHOD(methodname)
+
+Use `NAN_METHOD` to define your V8 accessible methods:
+
+```c++
+// .h:
+class Foo : public node::ObjectWrap {
+ ...
+
+ static NAN_METHOD(Bar);
+ static NAN_METHOD(Baz);
+}
+
+
+// .cc:
+NAN_METHOD(Foo::Bar) {
+ ...
+}
+
+NAN_METHOD(Foo::Baz) {
+ ...
+}
+```
+
+The reason for this macro is because of the method signature change in 0.11:
+
+```c++
+// 0.10 and below:
+Handle<Value> name(const Arguments& args)
+
+// 0.11 and above
+void name(const FunctionCallbackInfo<Value>& args)
+```
+
+The introduction of `FunctionCallbackInfo` brings additional complications:
+
+<a name="api_nan_getter"></a>
+### NAN_GETTER(methodname)
+
+Use `NAN_GETTER` to declare your V8 accessible getters. You get a `Local<String>` `property` and an appropriately typed `args` object that can act like the `args` argument to a `NAN_METHOD` call.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_GETTER`.
+
+<a name="api_nan_setter"></a>
+### NAN_SETTER(methodname)
+
+Use `NAN_SETTER` to declare your V8 accessible setters. Same as `NAN_GETTER` but you also get a `Local<Value>` `value` object to work with.
+
+<a name="api_nan_property_getter"></a>
+### NAN_PROPERTY_GETTER(cbname)
+Use `NAN_PROPERTY_GETTER` to declare your V8 accessible property getters. You get a `Local<String>` `property` and an appropriately typed `args` object that can act similar to the `args` argument to a `NAN_METHOD` call.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_GETTER`.
+
+<a name="api_nan_property_setter"></a>
+### NAN_PROPERTY_SETTER(cbname)
+Use `NAN_PROPERTY_SETTER` to declare your V8 accessible property setters. Same as `NAN_PROPERTY_GETTER` but you also get a `Local<Value>` `value` object to work with.
+
+<a name="api_nan_property_enumerator"></a>
+### NAN_PROPERTY_ENUMERATOR(cbname)
+Use `NAN_PROPERTY_ENUMERATOR` to declare your V8 accessible property enumerators. You get an appropriately typed `args` object like the `args` argument to a `NAN_PROPERTY_GETTER` call.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_ENUMERATOR`.
+
+<a name="api_nan_property_deleter"></a>
+### NAN_PROPERTY_DELETER(cbname)
+Use `NAN_PROPERTY_DELETER` to declare your V8 accessible property deleters. Same as `NAN_PROPERTY_GETTER`.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_DELETER`.
+
+<a name="api_nan_property_query"></a>
+### NAN_PROPERTY_QUERY(cbname)
+Use `NAN_PROPERTY_QUERY` to declare your V8 accessible property queries. Same as `NAN_PROPERTY_GETTER`.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_QUERY`.
+
+<a name="api_nan_index_getter"></a>
+### NAN_INDEX_GETTER(cbname)
+Use `NAN_INDEX_GETTER` to declare your V8 accessible index getters. You get a `uint32_t` `index` and an appropriately typed `args` object that can act similar to the `args` argument to a `NAN_METHOD` call.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_INDEX_GETTER`.
+
+<a name="api_nan_index_setter"></a>
+### NAN_INDEX_SETTER(cbname)
+Use `NAN_INDEX_SETTER` to declare your V8 accessible index setters. Same as `NAN_INDEX_GETTER` but you also get a `Local<Value>` `value` object to work with.
+
+<a name="api_nan_index_enumerator"></a>
+### NAN_INDEX_ENUMERATOR(cbname)
+Use `NAN_INDEX_ENUMERATOR` to declare your V8 accessible index enumerators. You get an appropriately typed `args` object like the `args` argument to a `NAN_INDEX_GETTER` call.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_INDEX_ENUMERATOR`.
+
+<a name="api_nan_index_deleter"></a>
+### NAN_INDEX_DELETER(cbname)
+Use `NAN_INDEX_DELETER` to declare your V8 accessible index deleters. Same as `NAN_INDEX_GETTER`.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_INDEX_DELETER`.
+
+<a name="api_nan_index_query"></a>
+### NAN_INDEX_QUERY(cbname)
+Use `NAN_INDEX_QUERY` to declare your V8 accessible index queries. Same as `NAN_INDEX_GETTER`.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_INDEX_QUERY`.
+
+<a name="api_nan_weak_callback"></a>
+### NAN_WEAK_CALLBACK(cbname)
+
+Use `NAN_WEAK_CALLBACK` to define your V8 WeakReference callbacks. Do not use for declaration. There is an argument object `const _NanWeakCallbackData<T, P> &data` allowing access to the weak object and the supplied parameter through its `GetValue` and `GetParameter` methods.
+
+```c++
+NAN_WEAK_CALLBACK(weakCallback) {
+ int *parameter = data.GetParameter();
+ NanMakeCallback(NanGetCurrentContext()->Global(), data.GetValue(), 0, NULL);
+ if ((*parameter)++ == 0) {
+ data.Revive();
+ } else {
+ delete parameter;
+ data.Dispose();
+ }
+}
+```
+
+<a name="api_nan_deprecated"></a>
+### NAN_DEPRECATED
+Declares a function as deprecated.
+
+```c++
+static NAN_DEPRECATED NAN_METHOD(foo) {
+ ...
+}
+```
+
+<a name="api_nan_inline"></a>
+### NAN_INLINE
+Inlines a function.
+
+```c++
+NAN_INLINE int foo(int bar) {
+ ...
+}
+```
+
+<a name="api_nan_new"></a>
+### Local&lt;T&gt; NanNew&lt;T&gt;( ... )
+
+Use `NanNew` to construct almost all v8 objects and make new local handles.
+
+```c++
+Local<String> s = NanNew<String>("value");
+
+...
+
+Persistent<Object> o;
+
+...
+
+Local<Object> lo = NanNew(o);
+
+```
+
+<a name="api_nan_undefined"></a>
+### Handle&lt;Primitive&gt; NanUndefined()
+
+Use instead of `Undefined()`
+
+<a name="api_nan_null"></a>
+### Handle&lt;Primitive&gt; NanNull()
+
+Use instead of `Null()`
+
+<a name="api_nan_true"></a>
+### Handle&lt;Primitive&gt; NanTrue()
+
+Use instead of `True()`
+
+<a name="api_nan_false"></a>
+### Handle&lt;Primitive&gt; NanFalse()
+
+Use instead of `False()`
+
+<a name="api_nan_return_value"></a>
+### NanReturnValue(Handle&lt;Value&gt;)
+
+Use `NanReturnValue` when you want to return a value from your V8 accessible method:
+
+```c++
+NAN_METHOD(Foo::Bar) {
+ ...
+
+ NanReturnValue(NanNew<String>("FooBar!"));
+}
+```
+
+No `return` statement required.
+
+<a name="api_nan_return_undefined"></a>
+### NanReturnUndefined()
+
+Use `NanReturnUndefined` when you don't want to return anything from your V8 accessible method:
+
+```c++
+NAN_METHOD(Foo::Baz) {
+ ...
+
+ NanReturnUndefined();
+}
+```
+
+<a name="api_nan_return_null"></a>
+### NanReturnNull()
+
+Use `NanReturnNull` when you want to return `Null` from your V8 accessible method:
+
+```c++
+NAN_METHOD(Foo::Baz) {
+ ...
+
+ NanReturnNull();
+}
+```
+
+<a name="api_nan_return_empty_string"></a>
+### NanReturnEmptyString()
+
+Use `NanReturnEmptyString` when you want to return an empty `String` from your V8 accessible method:
+
+```c++
+NAN_METHOD(Foo::Baz) {
+ ...
+
+ NanReturnEmptyString();
+}
+```
+
+<a name="api_nan_scope"></a>
+### NanScope()
+
+The introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanScope()` necessary, use it in place of `HandleScope scope`:
+
+```c++
+NAN_METHOD(Foo::Bar) {
+ NanScope();
+
+ NanReturnValue(NanNew<String>("FooBar!"));
+}
+```
+
+<a name="api_nan_escapable_scope"></a>
+### NanEscapableScope()
+
+The separation of handle scopes into escapable and inescapable scopes makes `NanEscapableScope()` necessary, use it in place of `HandleScope scope` when you later wish to `Close()` the scope:
+
+```c++
+Handle<String> Foo::Bar() {
+ NanEscapableScope();
+
+ return NanEscapeScope(NanNew<String>("FooBar!"));
+}
+```
+
+<a name="api_nan_esacpe_scope"></a>
+### Local&lt;T&gt; NanEscapeScope(Handle&lt;T&gt; value);
+Use together with `NanEscapableScope` to escape the scope. Corresponds to `HandleScope::Close` or `EscapableHandleScope::Escape`.
+
+<a name="api_nan_locker"></a>
+### NanLocker()
+
+The introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanLocker()` necessary, use it in place of `Locker locker`:
+
+```c++
+NAN_METHOD(Foo::Bar) {
+ NanLocker();
+ ...
+ NanUnlocker();
+}
+```
+
+<a name="api_nan_unlocker"></a>
+### NanUnlocker()
+
+The introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanUnlocker()` necessary, use it in place of `Unlocker unlocker`:
+
+```c++
+NAN_METHOD(Foo::Bar) {
+ NanLocker();
+ ...
+ NanUnlocker();
+}
+```
+
+<a name="api_nan_get_internal_field_pointer"></a>
+### void * NanGetInternalFieldPointer(Handle&lt;Object&gt;, int)
+
+Gets a pointer to the internal field with at `index` from a V8 `Object` handle.
+
+```c++
+Local<Object> obj;
+...
+NanGetInternalFieldPointer(obj, 0);
+```
+<a name="api_nan_set_internal_field_pointer"></a>
+### void NanSetInternalFieldPointer(Handle&lt;Object&gt;, int, void *)
+
+Sets the value of the internal field at `index` on a V8 `Object` handle.
+
+```c++
+static Persistent<Function> dataWrapperCtor;
+...
+Local<Object> wrapper = NanPersistentToLocal(dataWrapperCtor)->NewInstance();
+NanSetInternalFieldPointer(wrapper, 0, this);
+```
+
+<a name="api_nan_object_wrap_handle"></a>
+### Local&lt;Object&gt; NanObjectWrapHandle(Object)
+
+When you want to fetch the V8 object handle from a native object you've wrapped with Node's `ObjectWrap`, you should use `NanObjectWrapHandle`:
+
+```c++
+NanObjectWrapHandle(iterator)->Get(NanSymbol("end"))
+```
+
+<a name="api_nan_symbol"></a>
+### String NanSymbol(char *)
+
+Use to create string symbol objects (i.e. `v8::String::NewSymbol(x)`), for getting and setting object properties, or names of objects.
+
+```c++
+bool foo = false;
+if (obj->Has(NanSymbol("foo")))
+ foo = optionsObj->Get(NanSymbol("foo"))->BooleanValue()
+```
+
+<a name="api_nan_get_pointer_safe"></a>
+### Type NanGetPointerSafe(Type *[, Type])
+
+A helper for getting values from optional pointers. If the pointer is `NULL`, the function returns the optional default value, which defaults to `0`. Otherwise, the function returns the value the pointer points to.
+
+```c++
+char *plugh(uint32_t *optional) {
+ char res[] = "xyzzy";
+ uint32_t param = NanGetPointerSafe<uint32_t>(optional, 0x1337);
+ switch (param) {
+ ...
+ }
+ NanSetPointerSafe<uint32_t>(optional, 0xDEADBEEF);
+}
+```
+
+<a name="api_nan_set_pointer_safe"></a>
+### bool NanSetPointerSafe(Type *, Type)
+
+A helper for setting optional argument pointers. If the pointer is `NULL`, the function simply returns `false`. Otherwise, the value is assigned to the variable the pointer points to.
+
+```c++
+const char *plugh(size_t *outputsize) {
+ char res[] = "xyzzy";
+ if !(NanSetPointerSafe<size_t>(outputsize, strlen(res) + 1)) {
+ ...
+ }
+
+ ...
+}
+```
+
+<a name="api_nan_raw_string"></a>
+### void* NanRawString(Handle&lt;Value&gt;, enum Nan::Encoding, size_t *, void *, size_t, int)
+
+When you want to convert a V8 `String` to a `char*` buffer, use `NanRawString`. You have to supply an encoding as well as a pointer to a variable that will be assigned the number of bytes in the returned string. It is also possible to supply a buffer and its length to the function in order not to have a new buffer allocated. The final argument allows setting `String::WriteOptions`.
+Just remember that you'll end up with an object that you'll need to `delete[]` at some point unless you supply your own buffer:
+
+```c++
+size_t count;
+void* decoded = NanRawString(args[1], Nan::BASE64, &count, NULL, 0, String::HINT_MANY_WRITES_EXPECTED);
+char param_copy[count];
+memcpy(param_copy, decoded, count);
+delete[] decoded;
+```
+
+<a name="api_nan_c_string"></a>
+### char* NanCString(Handle&lt;Value&gt;, size_t *[, char *, size_t, int])
+
+When you want to convert a V8 `String` to a null-terminated C `char*` use `NanCString`. The resulting `char*` will be UTF-8-encoded, and you need to supply a pointer to a variable that will be assigned the number of bytes in the returned string. It is also possible to supply a buffer and its length to the function in order not to have a new buffer allocated. The final argument allows optionally setting `String::WriteOptions`, which default to `v8::String::NO_OPTIONS`.
+Just remember that you'll end up with an object that you'll need to `delete[]` at some point unless you supply your own buffer:
+
+```c++
+size_t count;
+char* name = NanCString(args[0], &count);
+```
+
+<a name="api_nan_boolean_option_value"></a>
+### bool NanBooleanOptionValue(Handle&lt;Value&gt;, Handle&lt;String&gt;[, bool])
+
+When you have an "options" object that you need to fetch properties from, boolean options can be fetched with this pair. They check first if the object exists (`IsEmpty`), then if the object has the given property (`Has`) then they get and convert/coerce the property to a `bool`.
+
+The optional last parameter is the *default* value, which is `false` if left off:
+
+```c++
+// `foo` is false unless the user supplies a truthy value for it
+bool foo = NanBooleanOptionValue(optionsObj, NanSymbol("foo"));
+// `bar` is true unless the user supplies a falsy value for it
+bool bar = NanBooleanOptionValueDefTrue(optionsObj, NanSymbol("bar"), true);
+```
+
+<a name="api_nan_uint32_option_value"></a>
+### uint32_t NanUInt32OptionValue(Handle&lt;Value&gt;, Handle&lt;String&gt;, uint32_t)
+
+Similar to `NanBooleanOptionValue`, use `NanUInt32OptionValue` to fetch an integer option from your options object. Can be any kind of JavaScript `Number` and it will be coerced to an unsigned 32-bit integer.
+
+Requires all 3 arguments as a default is not optional:
+
+```c++
+uint32_t count = NanUInt32OptionValue(optionsObj, NanSymbol("count"), 1024);
+```
+
+<a name="api_nan_error"></a>
+### NanError(message), NanTypeError(message), NanRangeError(message)
+
+For making `Error`, `TypeError` and `RangeError` objects.
+
+```c++
+Local<Value> res = NanError("you must supply a callback argument");
+```
+
+<a name="api_nan_throw_error"></a>
+### NanThrowError(message), NanThrowTypeError(message), NanThrowRangeError(message), NanThrowError(Local&lt;Value&gt;), NanThrowError(Local&lt;Value&gt;, int)
+
+For throwing `Error`, `TypeError` and `RangeError` objects. You should `return` this call:
+
+```c++
+return NanThrowError("you must supply a callback argument");
+```
+
+Can also handle any custom object you may want to throw. If used with the error code argument, it will add the supplied error code to the error object as a property called `code`.
+
+<a name="api_nan_new_buffer_handle"></a>
+### Local&lt;Object&gt; NanNewBufferHandle(char *, uint32_t), Local&lt;Object&gt; NanNewBufferHandle(uint32_t)
+
+The `Buffer` API has changed a little in Node 0.11, this helper provides consistent access to `Buffer` creation:
+
+```c++
+NanNewBufferHandle((char*)value.data(), value.size());
+```
+
+Can also be used to initialize a `Buffer` with just a `size` argument.
+
+Can also be supplied with a `NanFreeCallback` and a hint for the garbage collector.
+
+<a name="api_nan_buffer_use"></a>
+### Local&lt;Object&gt; NanBufferUse(char*, uint32_t)
+
+`Buffer::New(char*, uint32_t)` prior to 0.11 would make a copy of the data.
+While it was possible to get around this, it required a shim by passing a
+callback. So the new API `Buffer::Use(char*, uint32_t)` was introduced to remove
+needing to use this shim.
+
+`NanBufferUse` uses the `char*` passed as the backing data, and will free the
+memory automatically when the weak callback is called. Keep this in mind, as
+careless use can lead to "double free or corruption" and other cryptic failures.
+
+<a name="api_nan_has_instance"></a>
+### bool NanHasInstance(Persistent&lt;FunctionTemplate&gt;&, Handle&lt;Value&gt;)
+
+Can be used to check the type of an object to determine it is of a particular class you have already defined and have a `Persistent<FunctionTemplate>` handle for.
+
+<a href="#api_nan_new_context_handle">
+### Local&lt;Context&gt; NanNewContextHandle([ExtensionConfiguration*, Handle&lt;ObjectTemplate&gt;, Handle&lt;Value&gt;])
+Creates a new `Local<Context>` handle.
+
+```c++
+Local<FunctionTemplate> ftmpl = NanNew<FunctionTemplate>();
+Local<ObjectTemplate> otmpl = ftmpl->InstanceTemplate();
+Local<Context> ctx = NanNewContextHandle(NULL, otmpl);
+```
+
+<a href="#api_nan_get_current_context">
+### Local<Context> NanGetCurrentContext()
+
+Gets the current context.
+
+```c++
+Local<Context> ctx = NanGetCurrentContext();
+```
+
+<a name="api_nan_dispose_persistent"></a>
+### void NanDisposePersistent(Persistent&lt;T&gt; &)
+
+Use `NanDisposePersistent` to dispose a `Persistent` handle.
+
+```c++
+NanDisposePersistent(persistentHandle);
+```
+
+<a name="api_nan_assign_persistent"></a>
+### NanAssignPersistent(type, handle, object)
+
+Use `NanAssignPersistent` to assign a non-`Persistent` handle to a `Persistent` one. You can no longer just declare a `Persistent` handle and assign directly to it later, you have to `Reset` it in Node 0.11, so this makes it easier.
+
+In general it is now better to place anything you want to protect from V8's garbage collector as properties of a generic `Object` and then assign that to a `Persistent`. This works in older versions of Node also if you use `NanAssignPersistent`:
+
+```c++
+Persistent<Object> persistentHandle;
+
+...
+
+Local<Object> obj = NanNew<Object>();
+obj->Set(NanSymbol("key"), keyHandle); // where keyHandle might be a Local<String>
+NanAssignPersistent(Object, persistentHandle, obj)
+```
+
+<a name="api_nan_make_weak_persistent"></a>
+### NanMakeWeakPersistent(Handle&lt;T&gt; handle, P* parameter, _NanWeakCallbackInfo&lt;T, P&gt;::Callback callback)
+
+Creates a weak persistent handle with the supplied parameter and `NAN_WEAK_CALLBACK`. The callback has to be fully specialized to work on all versions of Node.
+
+```c++
+NAN_WEAK_CALLBACK(weakCallback) {
+
+...
+
+}
+
+Local<Function> func;
+
+...
+
+int *parameter = new int(0);
+NanMakeWeakPersistent(func, parameter, &weakCallback<Function, int>);
+```
+
+<a name="api_nan_set_template"></a>
+### NanSetTemplate(templ, name, value)
+
+Use to add properties on object and function templates.
+
+<a name="api_nan_make_callback"></a>
+### NanMakeCallback(target, func, argc, argv)
+
+Use instead of `node::MakeCallback` to call javascript functions. This is the only proper way of calling functions.
+
+<a name="api_nan_compile_script"></a>
+### NanCompileScript(Handle<String> s [, const ScriptOrigin&amp; origin])
+
+Use to create new scripts bound to the current context.
+
+<a name="api_nan_run_script"></a>
+### NanRunScript(script)
+
+Use to run both bound and unbound scripts.
+
+<a name="api_nan_adjust_external_memory"></a>
+### NanAdjustExternalMemory(int change_in_bytes)
+
+Simply does `AdjustAmountOfExternalAllocatedMemory`
+
+<a name="api_nan_add_gc_epilogue_callback"></a>
+### NanAddGCEpilogueCallback(GCEpilogueCallback callback, GCType gc_type_filter=kGCTypeAll)
+
+Simply does `AddGCEpilogueCallback`
+
+<a name="api_nan_add_gc_prologue_callback"></a>
+### NanAddGCPrologueCallback(GCPrologueCallback callback, GCType gc_type_filter=kGCTypeAll)
+
+Simply does `AddGCPrologueCallback`
+
+<a name="api_nan_remove_gc_epilogue_callback"></a>
+### NanRemoveGCEpilogueCallback(GCEpilogueCallback callback)
+
+Simply does `RemoveGCEpilogueCallback`
+
+<a name="api_nan_add_gc_prologue_callback"></a>
+### NanRemoveGCPrologueCallback(GCPrologueCallback callback)
+
+Simply does `RemoveGCPrologueCallback`
+
+<a name="api_nan_get_heap_statistics"></a>
+### NanGetHeapStatistics(HeapStatistics *heap_statistics)
+
+Simply does `GetHeapStatistics`
+
+<a name="api_nan_callback"></a>
+### NanCallback
+
+Because of the difficulties imposed by the changes to `Persistent` handles in V8 in Node 0.11, creating `Persistent` versions of your `Handle<Function>` is annoyingly tricky. `NanCallback` makes it easier by taking your handle, making it persistent until the `NanCallback` is deleted and even providing a handy `Call()` method to fetch and execute the callback `Function`.
+
+```c++
+Local<Function> callbackHandle = args[0].As<Function>();
+NanCallback *callback = new NanCallback(callbackHandle);
+// pass `callback` around and it's safe from GC until you:
+delete callback;
+```
+
+You can execute the callback like so:
+
+```c++
+// no arguments:
+callback->Call(0, NULL);
+
+// an error argument:
+Handle<Value> argv[] = {
+ NanError(NanNew<String>("fail!"))
+};
+callback->Call(1, argv);
+
+// a success argument:
+Handle<Value> argv[] = {
+ NanNull(),
+ NanNew<String>("w00t!")
+};
+callback->Call(2, argv);
+```
+
+`NanCallback` also has a `Local<Function> GetCallback()` method that you can use
+to fetch a local handle to the underlying callback function, as well as a
+`void SetFunction(Handle<Function>)` for setting the callback on the
+`NanCallback`. Additionally a generic constructor is available for using
+`NanCallback` without performing heap allocations.
+
+<a name="api_nan_async_worker"></a>
+### NanAsyncWorker
+
+`NanAsyncWorker` is an abstract class that you can subclass to have much of the annoying async queuing and handling taken care of for you. It can even store arbitrary V8 objects for you and have them persist while the async work is in progress.
+
+See a rough outline of the implementation:
+
+```c++
+class NanAsyncWorker {
+public:
+ NanAsyncWorker (NanCallback *callback);
+
+ // Clean up persistent handles and delete the *callback
+ virtual ~NanAsyncWorker ();
+
+ // Check the `char *errmsg` property and call HandleOKCallback()
+ // or HandleErrorCallback depending on whether it has been set or not
+ virtual void WorkComplete ();
+
+ // You must implement this to do some async work. If there is an
+ // error then allocate `errmsg` to a message and the callback will
+ // be passed that string in an Error object
+ virtual void Execute ();
+
+ // Save a V8 object in a Persistent handle to protect it from GC
+ void SavePersistent(const char *key, Local<Object> &obj);
+
+ // Fetch a stored V8 object (don't call from within `Execute()`)
+ Local<Object> GetFromPersistent(const char *key);
+
+protected:
+ // Set this if there is an error, otherwise it's NULL
+ const char *errmsg;
+
+ // Default implementation calls the callback function with no arguments.
+ // Override this to return meaningful data
+ virtual void HandleOKCallback ();
+
+ // Default implementation calls the callback function with an Error object
+ // wrapping the `errmsg` string
+ virtual void HandleErrorCallback ();
+};
+```
+
+<a name="api_nan_async_queue_worker"></a>
+### NanAsyncQueueWorker(NanAsyncWorker *)
+
+`NanAsyncQueueWorker` will run a `NanAsyncWorker` asynchronously via libuv. Both the *execute* and *after_work* steps are taken care of for you&mdash;most of the logic for this is embedded in `NanAsyncWorker`.
+
+### Contributors
+
+NAN is only possible due to the excellent work of the following contributors:
+
+<table><tbody>
+<tr><th align="left">Rod Vagg</th><td><a href="https://github.com/rvagg">GitHub/rvagg</a></td><td><a href="http://twitter.com/rvagg">Twitter/@rvagg</a></td></tr>
+<tr><th align="left">Benjamin Byholm</th><td><a href="https://github.com/kkoopa/">GitHub/kkoopa</a></td></tr>
+<tr><th align="left">Trevor Norris</th><td><a href="https://github.com/trevnorris">GitHub/trevnorris</a></td><td><a href="http://twitter.com/trevnorris">Twitter/@trevnorris</a></td></tr>
+<tr><th align="left">Nathan Rajlich</th><td><a href="https://github.com/TooTallNate">GitHub/TooTallNate</a></td><td><a href="http://twitter.com/TooTallNate">Twitter/@TooTallNate</a></td></tr>
+<tr><th align="left">Brett Lawson</th><td><a href="https://github.com/brett19">GitHub/brett19</a></td><td><a href="http://twitter.com/brett19x">Twitter/@brett19x</a></td></tr>
+<tr><th align="left">Ben Noordhuis</th><td><a href="https://github.com/bnoordhuis">GitHub/bnoordhuis</a></td><td><a href="http://twitter.com/bnoordhuis">Twitter/@bnoordhuis</a></td></tr>
+</tbody></table>
+
+Licence &amp; copyright
+-----------------------
+
+Copyright (c) 2014 NAN contributors (listed above).
+
+Native Abstractions for Node.js is licensed under an MIT +no-false-attribs license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/build/config.gypi b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/build/config.gypi
new file mode 100644
index 0000000..e085a50
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/build/config.gypi
@@ -0,0 +1,38 @@
+# Do not edit. File was generated by node-gyp's "configure" step
+{
+ "target_defaults": {
+ "cflags": [],
+ "default_configuration": "Release",
+ "defines": [],
+ "include_dirs": [],
+ "libraries": []
+ },
+ "variables": {
+ "clang": 0,
+ "gcc_version": 47,
+ "host_arch": "x64",
+ "node_install_npm": "true",
+ "node_prefix": "",
+ "node_shared_cares": "false",
+ "node_shared_http_parser": "false",
+ "node_shared_libuv": "false",
+ "node_shared_openssl": "false",
+ "node_shared_v8": "false",
+ "node_shared_zlib": "false",
+ "node_tag": "",
+ "node_unsafe_optimizations": 0,
+ "node_use_dtrace": "false",
+ "node_use_etw": "false",
+ "node_use_openssl": "true",
+ "node_use_perfctr": "false",
+ "node_use_systemtap": "false",
+ "python": "/usr/bin/python",
+ "target_arch": "x64",
+ "v8_enable_gdbjit": 0,
+ "v8_no_strict_aliasing": 1,
+ "v8_use_snapshot": "true",
+ "nodedir": "/home/rvagg/.node-gyp/0.10.21",
+ "copy_dev_lib": "true",
+ "standalone_static_library": 1
+ }
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/include_dirs.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/include_dirs.js
new file mode 100644
index 0000000..4f1dfb4
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/include_dirs.js
@@ -0,0 +1 @@
+console.log(require('path').relative('.', __dirname));
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/nan.h b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/nan.h
new file mode 100644
index 0000000..bc544f5
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/nan.h
@@ -0,0 +1,1910 @@
+/**********************************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2014 NAN contributors:
+ * - Rod Vagg <https://github.com/rvagg>
+ * - Benjamin Byholm <https://github.com/kkoopa>
+ * - Trevor Norris <https://github.com/trevnorris>
+ * - Nathan Rajlich <https://github.com/TooTallNate>
+ * - Brett Lawson <https://github.com/brett19>
+ * - Ben Noordhuis <https://github.com/bnoordhuis>
+ *
+ * MIT +no-false-attribs License <https://github.com/rvagg/nan/blob/master/LICENSE>
+ *
+ * Version 1.0.0 (current Node unstable: 0.11.13, Node stable: 0.10.28)
+ *
+ * ChangeLog:
+ * * 1.0.0 May 4 2014
+ * - Heavy API changes for V8 3.25 / Node 0.11.13
+ * - Use cpplint.py
+ * - Removed NanInitPersistent
+ * - Removed NanPersistentToLocal
+ * - Removed NanFromV8String
+ * - Removed NanMakeWeak
+ * - Removed NanNewLocal
+ * - Removed NAN_WEAK_CALLBACK_OBJECT
+ * - Removed NAN_WEAK_CALLBACK_DATA
+ * - Introduce NanNew, replaces NanNewLocal, NanPersistentToLocal, adds many overloaded typed versions
+ * - Introduce NanUndefined, NanNull, NanTrue and NanFalse
+ * - Introduce NanEscapableScope and NanEscapeScope
+ * - Introduce NanMakeWeakPersistent (requires a special callback to work on both old and new node)
+ * - Introduce NanMakeCallback for node::MakeCallback
+ * - Introduce NanSetTemplate
+ * - Introduce NanGetCurrentContext
+ * - Introduce NanCompileScript and NanRunScript
+ * - Introduce NanAdjustExternalMemory
+ * - Introduce NanAddGCEpilogueCallback, NanAddGCPrologueCallback, NanRemoveGCEpilogueCallback, NanRemoveGCPrologueCallback
+ * - Introduce NanGetHeapStatistics
+ * - Rename NanAsyncWorker#SavePersistent() to SaveToPersistent()
+ *
+ * * 0.8.0 Jan 9 2014
+ * - NanDispose -> NanDisposePersistent, deprecate NanDispose
+ * - Extract _NAN_*_RETURN_TYPE, pull up NAN_*()
+ *
+ * * 0.7.1 Jan 9 2014
+ * - Fixes to work against debug builds of Node
+ * - Safer NanPersistentToLocal (avoid reinterpret_cast)
+ * - Speed up common NanRawString case by only extracting flattened string when necessary
+ *
+ * * 0.7.0 Dec 17 2013
+ * - New no-arg form of NanCallback() constructor.
+ * - NanCallback#Call takes Handle rather than Local
+ * - Removed deprecated NanCallback#Run method, use NanCallback#Call instead
+ * - Split off _NAN_*_ARGS_TYPE from _NAN_*_ARGS
+ * - Restore (unofficial) Node 0.6 compatibility at NanCallback#Call()
+ * - Introduce NanRawString() for char* (or appropriate void*) from v8::String
+ * (replacement for NanFromV8String)
+ * - Introduce NanCString() for null-terminated char* from v8::String
+ *
+ * * 0.6.0 Nov 21 2013
+ * - Introduce NanNewLocal<T>(v8::Handle<T> value) for use in place of
+ * v8::Local<T>::New(...) since v8 started requiring isolate in Node 0.11.9
+ *
+ * * 0.5.2 Nov 16 2013
+ * - Convert SavePersistent and GetFromPersistent in NanAsyncWorker from protected and public
+ *
+ * * 0.5.1 Nov 12 2013
+ * - Use node::MakeCallback() instead of direct v8::Function::Call()
+ *
+ * * 0.5.0 Nov 11 2013
+ * - Added @TooTallNate as collaborator
+ * - New, much simpler, "include_dirs" for binding.gyp
+ * - Added full range of NAN_INDEX_* macros to match NAN_PROPERTY_* macros
+ *
+ * * 0.4.4 Nov 2 2013
+ * - Isolate argument from v8::Persistent::MakeWeak removed for 0.11.8+
+ *
+ * * 0.4.3 Nov 2 2013
+ * - Include node_object_wrap.h, removed from node.h for Node 0.11.8.
+ *
+ * * 0.4.2 Nov 2 2013
+ * - Handle deprecation of v8::Persistent::Dispose(v8::Isolate* isolate)) for
+ * Node 0.11.8 release.
+ *
+ * * 0.4.1 Sep 16 2013
+ * - Added explicit `#include <uv.h>` as it was removed from node.h for v0.11.8
+ *
+ * * 0.4.0 Sep 2 2013
+ * - Added NAN_INLINE and NAN_DEPRECATED and made use of them
+ * - Added NanError, NanTypeError and NanRangeError
+ * - Cleaned up code
+ *
+ * * 0.3.2 Aug 30 2013
+ * - Fix missing scope declaration in GetFromPersistent() and SaveToPersistent
+ * in NanAsyncWorker
+ *
+ * * 0.3.1 Aug 20 2013
+ * - fix "not all control paths return a value" compile warning on some platforms
+ *
+ * * 0.3.0 Aug 19 2013
+ * - Made NAN work with NPM
+ * - Lots of fixes to NanFromV8String, pulling in features from new Node core
+ * - Changed node::encoding to Nan::Encoding in NanFromV8String to unify the API
+ * - Added optional error number argument for NanThrowError()
+ * - Added NanInitPersistent()
+ * - Added NanReturnNull() and NanReturnEmptyString()
+ * - Added NanLocker and NanUnlocker
+ * - Added missing scopes
+ * - Made sure to clear disposed Persistent handles
+ * - Changed NanAsyncWorker to allocate error messages on the heap
+ * - Changed NanThrowError(Local<Value>) to NanThrowError(Handle<Value>)
+ * - Fixed leak in NanAsyncWorker when errmsg is used
+ *
+ * * 0.2.2 Aug 5 2013
+ * - Fixed usage of undefined variable with node::BASE64 in NanFromV8String()
+ *
+ * * 0.2.1 Aug 5 2013
+ * - Fixed 0.8 breakage, node::BUFFER encoding type not available in 0.8 for
+ * NanFromV8String()
+ *
+ * * 0.2.0 Aug 5 2013
+ * - Added NAN_PROPERTY_GETTER, NAN_PROPERTY_SETTER, NAN_PROPERTY_ENUMERATOR,
+ * NAN_PROPERTY_DELETER, NAN_PROPERTY_QUERY
+ * - Extracted _NAN_METHOD_ARGS, _NAN_GETTER_ARGS, _NAN_SETTER_ARGS,
+ * _NAN_PROPERTY_GETTER_ARGS, _NAN_PROPERTY_SETTER_ARGS,
+ * _NAN_PROPERTY_ENUMERATOR_ARGS, _NAN_PROPERTY_DELETER_ARGS,
+ * _NAN_PROPERTY_QUERY_ARGS
+ * - Added NanGetInternalFieldPointer, NanSetInternalFieldPointer
+ * - Added NAN_WEAK_CALLBACK, NAN_WEAK_CALLBACK_OBJECT,
+ * NAN_WEAK_CALLBACK_DATA, NanMakeWeak
+ * - Renamed THROW_ERROR to _NAN_THROW_ERROR
+ * - Added NanNewBufferHandle(char*, size_t, node::smalloc::FreeCallback, void*)
+ * - Added NanBufferUse(char*, uint32_t)
+ * - Added NanNewContextHandle(v8::ExtensionConfiguration*,
+ * v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::Value>)
+ * - Fixed broken NanCallback#GetFunction()
+ * - Added optional encoding and size arguments to NanFromV8String()
+ * - Added NanGetPointerSafe() and NanSetPointerSafe()
+ * - Added initial test suite (to be expanded)
+ * - Allow NanUInt32OptionValue to convert any Number object
+ *
+ * * 0.1.0 Jul 21 2013
+ * - Added `NAN_GETTER`, `NAN_SETTER`
+ * - Added `NanThrowError` with single Local<Value> argument
+ * - Added `NanNewBufferHandle` with single uint32_t argument
+ * - Added `NanHasInstance(Persistent<FunctionTemplate>&, Handle<Value>)`
+ * - Added `Local<Function> NanCallback#GetFunction()`
+ * - Added `NanCallback#Call(int, Local<Value>[])`
+ * - Deprecated `NanCallback#Run(int, Local<Value>[])` in favour of Call
+ *
+ * See https://github.com/rvagg/nan for the latest update to this file
+ **********************************************************************************/
+
+#ifndef NAN_H_
+#define NAN_H_
+
+#include <uv.h>
+#include <node.h>
+#include <node_buffer.h>
+#include <node_version.h>
+#include <node_object_wrap.h>
+#include <string.h>
+
+#if defined(__GNUC__) && !defined(DEBUG)
+# define NAN_INLINE inline __attribute__((always_inline))
+#elif defined(_MSC_VER) && !defined(DEBUG)
+# define NAN_INLINE __forceinline
+#else
+# define NAN_INLINE inline
+#endif
+
+#if defined(__GNUC__) && !V8_DISABLE_DEPRECATIONS
+# define NAN_DEPRECATED __attribute__((deprecated))
+#elif defined(_MSC_VER) && !V8_DISABLE_DEPRECATIONS
+# define NAN_DEPRECATED __declspec(deprecated)
+#else
+# define NAN_DEPRECATED
+#endif
+
+// some generic helpers
+
+template<typename T> NAN_INLINE bool NanSetPointerSafe(
+ T *var
+ , T val
+) {
+ if (var) {
+ *var = val;
+ return true;
+ } else {
+ return false;
+ }
+}
+
+template<typename T> NAN_INLINE T NanGetPointerSafe(
+ T *var
+ , T fallback = reinterpret_cast<T>(0)
+) {
+ if (var) {
+ return *var;
+ } else {
+ return fallback;
+ }
+}
+
+NAN_INLINE bool NanBooleanOptionValue(
+ v8::Local<v8::Object> optionsObj
+ , v8::Handle<v8::String> opt, bool def
+) {
+ if (def) {
+ return optionsObj.IsEmpty()
+ || !optionsObj->Has(opt)
+ || optionsObj->Get(opt)->BooleanValue();
+ } else {
+ return !optionsObj.IsEmpty()
+ && optionsObj->Has(opt)
+ && optionsObj->Get(opt)->BooleanValue();
+ }
+}
+
+NAN_INLINE bool NanBooleanOptionValue(
+ v8::Local<v8::Object> optionsObj
+ , v8::Handle<v8::String> opt
+) {
+ return NanBooleanOptionValue(optionsObj, opt, false);
+}
+
+NAN_INLINE uint32_t NanUInt32OptionValue(
+ v8::Local<v8::Object> optionsObj
+ , v8::Handle<v8::String> opt
+ , uint32_t def
+) {
+ return !optionsObj.IsEmpty()
+ && optionsObj->Has(opt)
+ && optionsObj->Get(opt)->IsNumber()
+ ? optionsObj->Get(opt)->Uint32Value()
+ : def;
+}
+
+#if (NODE_MODULE_VERSION > 0x000B)
+// Node 0.11+ (0.11.3 and below won't compile with these)
+
+# define _NAN_METHOD_ARGS_TYPE const v8::FunctionCallbackInfo<v8::Value>&
+# define _NAN_METHOD_ARGS _NAN_METHOD_ARGS_TYPE args
+# define _NAN_METHOD_RETURN_TYPE void
+
+# define _NAN_GETTER_ARGS_TYPE const v8::PropertyCallbackInfo<v8::Value>&
+# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args
+# define _NAN_GETTER_RETURN_TYPE void
+
+# define _NAN_SETTER_ARGS_TYPE const v8::PropertyCallbackInfo<void>&
+# define _NAN_SETTER_ARGS _NAN_SETTER_ARGS_TYPE args
+# define _NAN_SETTER_RETURN_TYPE void
+
+# define _NAN_PROPERTY_GETTER_ARGS_TYPE \
+ const v8::PropertyCallbackInfo<v8::Value>&
+# define _NAN_PROPERTY_GETTER_ARGS _NAN_PROPERTY_GETTER_ARGS_TYPE args
+# define _NAN_PROPERTY_GETTER_RETURN_TYPE void
+
+# define _NAN_PROPERTY_SETTER_ARGS_TYPE \
+ const v8::PropertyCallbackInfo<v8::Value>&
+# define _NAN_PROPERTY_SETTER_ARGS _NAN_PROPERTY_SETTER_ARGS_TYPE args
+# define _NAN_PROPERTY_SETTER_RETURN_TYPE void
+
+# define _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE \
+ const v8::PropertyCallbackInfo<v8::Array>&
+# define _NAN_PROPERTY_ENUMERATOR_ARGS _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE args
+# define _NAN_PROPERTY_ENUMERATOR_RETURN_TYPE void
+
+# define _NAN_PROPERTY_DELETER_ARGS_TYPE \
+ const v8::PropertyCallbackInfo<v8::Boolean>&
+# define _NAN_PROPERTY_DELETER_ARGS \
+ _NAN_PROPERTY_DELETER_ARGS_TYPE args
+# define _NAN_PROPERTY_DELETER_RETURN_TYPE void
+
+# define _NAN_PROPERTY_QUERY_ARGS_TYPE \
+ const v8::PropertyCallbackInfo<v8::Integer>&
+# define _NAN_PROPERTY_QUERY_ARGS _NAN_PROPERTY_QUERY_ARGS_TYPE args
+# define _NAN_PROPERTY_QUERY_RETURN_TYPE void
+
+# define _NAN_INDEX_GETTER_ARGS_TYPE \
+ const v8::PropertyCallbackInfo<v8::Value>&
+# define _NAN_INDEX_GETTER_ARGS _NAN_INDEX_GETTER_ARGS_TYPE args
+# define _NAN_INDEX_GETTER_RETURN_TYPE void
+
+# define _NAN_INDEX_SETTER_ARGS_TYPE \
+ const v8::PropertyCallbackInfo<v8::Value>&
+# define _NAN_INDEX_SETTER_ARGS _NAN_INDEX_SETTER_ARGS_TYPE args
+# define _NAN_INDEX_SETTER_RETURN_TYPE void
+
+# define _NAN_INDEX_ENUMERATOR_ARGS_TYPE \
+ const v8::PropertyCallbackInfo<v8::Array>&
+# define _NAN_INDEX_ENUMERATOR_ARGS _NAN_INDEX_ENUMERATOR_ARGS_TYPE args
+# define _NAN_INDEX_ENUMERATOR_RETURN_TYPE void
+
+# define _NAN_INDEX_DELETER_ARGS_TYPE \
+ const v8::PropertyCallbackInfo<v8::Boolean>&
+# define _NAN_INDEX_DELETER_ARGS _NAN_INDEX_DELETER_ARGS_TYPE args
+# define _NAN_INDEX_DELETER_RETURN_TYPE void
+
+# define _NAN_INDEX_QUERY_ARGS_TYPE \
+ const v8::PropertyCallbackInfo<v8::Integer>&
+# define _NAN_INDEX_QUERY_ARGS _NAN_INDEX_QUERY_ARGS_TYPE args
+# define _NAN_INDEX_QUERY_RETURN_TYPE void
+
+typedef v8::FunctionCallback NanFunctionCallback;
+static v8::Isolate* nan_isolate = v8::Isolate::GetCurrent();
+
+# define NanUndefined() v8::Undefined(nan_isolate)
+# define NanNull() v8::Null(nan_isolate)
+# define NanTrue() v8::True(nan_isolate)
+# define NanFalse() v8::False(nan_isolate)
+# define NanAdjustExternalMemory(amount) \
+ nan_isolate->AdjustAmountOfExternalAllocatedMemory(amount)
+# define NanSetTemplate(templ, name, value) templ->Set(nan_isolate, name, value)
+# define NanGetCurrentContext() nan_isolate->GetCurrentContext()
+# define NanMakeCallback(target, func, argc, argv) \
+ node::MakeCallback(nan_isolate, target, func, argc, argv)
+# define NanGetInternalFieldPointer(object, index) \
+ object->GetAlignedPointerFromInternalField(index)
+# define NanSetInternalFieldPointer(object, index, value) \
+ object->SetAlignedPointerInInternalField(index, value)
+
+ template<typename T>
+ NAN_INLINE v8::Local<T> NanNew() {
+ return T::New(nan_isolate);
+ }
+
+ template<typename T, typename P>
+ NAN_INLINE v8::Local<T> NanNew(P arg1) {
+ return T::New(nan_isolate, arg1);
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<v8::Signature> NanNew(
+ v8::Handle<v8::FunctionTemplate> receiver
+ , int argc
+ , v8::Handle<v8::FunctionTemplate> argv[] = 0) {
+ return v8::Signature::New(nan_isolate, receiver, argc, argv);
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<v8::FunctionTemplate> NanNew(
+ NanFunctionCallback callback
+ , v8::Handle<v8::Value> data = v8::Handle<v8::Value>()
+ , v8::Handle<v8::Signature> signature = v8::Handle<v8::Signature>()) {
+ return T::New(nan_isolate, callback, data, signature);
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<T> NanNew(v8::Handle<T> arg1) {
+ return v8::Local<T>::New(nan_isolate, arg1);
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<T> NanNew(const v8::Persistent<T> &arg1) {
+ return v8::Local<T>::New(nan_isolate, arg1);
+ }
+
+ template<typename T, typename P>
+ NAN_INLINE v8::Local<T> NanNew(P arg1, int arg2) {
+ return T::New(nan_isolate, arg1, arg2);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Array> NanNew<v8::Array>() {
+ return v8::Array::New(nan_isolate);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Array> NanNew<v8::Array>(int length) {
+ return v8::Array::New(nan_isolate, length);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Date> NanNew<v8::Date>(double time) {
+ return v8::Date::New(nan_isolate, time).As<v8::Date>();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Date> NanNew<v8::Date>(int time) {
+ return v8::Date::New(nan_isolate, time).As<v8::Date>();
+ }
+
+ typedef v8::UnboundScript NanUnboundScript;
+ typedef v8::Script NanBoundScript;
+
+ template<typename T, typename P>
+ NAN_INLINE v8::Local<T> NanNew(
+ P s
+ , const v8::ScriptOrigin& origin
+ ) {
+ v8::ScriptCompiler::Source source(s, origin);
+ return v8::ScriptCompiler::CompileUnbound(nan_isolate, &source);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<NanUnboundScript> NanNew<NanUnboundScript>(
+ v8::Local<v8::String> s
+ ) {
+ v8::ScriptCompiler::Source source(s);
+ return v8::ScriptCompiler::CompileUnbound(nan_isolate, &source);
+ }
+
+ NAN_INLINE v8::Local<v8::String> NanNew(
+ v8::String::ExternalStringResource *resource) {
+ return v8::String::NewExternal(nan_isolate, resource);
+ }
+
+ NAN_INLINE v8::Local<v8::String> NanNew(
+ v8::String::ExternalAsciiStringResource *resource) {
+ return v8::String::NewExternal(nan_isolate, resource);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::BooleanObject> NanNew(bool value) {
+ return v8::BooleanObject::New(value).As<v8::BooleanObject>();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::StringObject>
+ NanNew<v8::StringObject, v8::Local<v8::String> >(
+ v8::Local<v8::String> value) {
+ return v8::StringObject::New(value).As<v8::StringObject>();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::StringObject>
+ NanNew<v8::StringObject, v8::Handle<v8::String> >(
+ v8::Handle<v8::String> value) {
+ return v8::StringObject::New(value).As<v8::StringObject>();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::NumberObject> NanNew<v8::NumberObject>(double val) {
+ return v8::NumberObject::New(nan_isolate, val).As<v8::NumberObject>();
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<v8::RegExp> NanNew(
+ v8::Handle<v8::String> pattern, v8::RegExp::Flags flags) {
+ return v8::RegExp::New(pattern, flags);
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<v8::RegExp> NanNew(
+ v8::Local<v8::String> pattern, v8::RegExp::Flags flags) {
+ return v8::RegExp::New(pattern, flags);
+ }
+
+ template<typename T, typename P>
+ NAN_INLINE v8::Local<v8::RegExp> NanNew(
+ v8::Handle<v8::String> pattern, v8::RegExp::Flags flags) {
+ return v8::RegExp::New(pattern, flags);
+ }
+
+ template<typename T, typename P>
+ NAN_INLINE v8::Local<v8::RegExp> NanNew(
+ v8::Local<v8::String> pattern, v8::RegExp::Flags flags) {
+ return v8::RegExp::New(pattern, flags);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Uint32> NanNew<v8::Uint32, int32_t>(int32_t val) {
+ return v8::Uint32::NewFromUnsigned(nan_isolate, val)->ToUint32();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Uint32> NanNew<v8::Uint32, uint32_t>(uint32_t val) {
+ return v8::Uint32::NewFromUnsigned(nan_isolate, val)->ToUint32();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Int32> NanNew<v8::Int32, int32_t>(int32_t val) {
+ return v8::Int32::New(nan_isolate, val)->ToInt32();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Int32> NanNew<v8::Int32, uint32_t>(uint32_t val) {
+ return v8::Int32::New(nan_isolate, val)->ToInt32();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, char *>(
+ char *arg
+ , int length) {
+ return v8::String::NewFromUtf8(
+ nan_isolate
+ , arg
+ , v8::String::kNormalString
+ , length);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const char *>(
+ const char *arg
+ , int length) {
+ return v8::String::NewFromUtf8(
+ nan_isolate
+ , arg
+ , v8::String::kNormalString
+ , length);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, char *>(char *arg) {
+ return v8::String::NewFromUtf8(nan_isolate, arg);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const char *>(
+ const char *arg) {
+ return v8::String::NewFromUtf8(nan_isolate, arg);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, uint8_t *>(
+ uint8_t *arg
+ , int length) {
+ return v8::String::NewFromOneByte(
+ nan_isolate
+ , arg
+ , v8::String::kNormalString
+ , length);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const uint8_t *>(
+ const uint8_t *arg
+ , int length) {
+ return v8::String::NewFromOneByte(
+ nan_isolate
+ , arg
+ , v8::String::kNormalString
+ , length);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, uint8_t *>(uint8_t *arg) {
+ return v8::String::NewFromOneByte(nan_isolate, arg);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const uint8_t *>(
+ const uint8_t *arg) {
+ return v8::String::NewFromOneByte(nan_isolate, arg);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, uint16_t *>(
+ uint16_t *arg
+ , int length) {
+ return v8::String::NewFromTwoByte(
+ nan_isolate
+ , arg
+ , v8::String::kNormalString
+ , length);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const uint16_t *>(
+ const uint16_t *arg
+ , int length) {
+ return v8::String::NewFromTwoByte(
+ nan_isolate
+ , arg
+ , v8::String::kNormalString
+ , length);
+ }
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, uint16_t *>(
+ uint16_t *arg) {
+ return v8::String::NewFromTwoByte(nan_isolate, arg);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const uint16_t *>(
+ const uint16_t *arg) {
+ return v8::String::NewFromTwoByte(nan_isolate, arg);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String>() {
+ return v8::String::Empty(nan_isolate);
+ }
+
+ NAN_INLINE void NanAddGCEpilogueCallback(
+ v8::Isolate::GCEpilogueCallback callback
+ , v8::GCType gc_type_filter = v8::kGCTypeAll) {
+ nan_isolate->AddGCEpilogueCallback(callback, gc_type_filter);
+ }
+
+ NAN_INLINE void NanRemoveGCEpilogueCallback(
+ v8::Isolate::GCEpilogueCallback callback) {
+ nan_isolate->RemoveGCEpilogueCallback(callback);
+ }
+
+ NAN_INLINE void NanAddGCPrologueCallback(
+ v8::Isolate::GCPrologueCallback callback
+ , v8::GCType gc_type_filter = v8::kGCTypeAll) {
+ nan_isolate->AddGCPrologueCallback(callback, gc_type_filter);
+ }
+
+ NAN_INLINE void NanRemoveGCPrologueCallback(
+ v8::Isolate::GCPrologueCallback callback) {
+ nan_isolate->RemoveGCPrologueCallback(callback);
+ }
+
+ NAN_INLINE void NanGetHeapStatistics(
+ v8::HeapStatistics *heap_statistics) {
+ nan_isolate->GetHeapStatistics(heap_statistics);
+ }
+
+# define NanSymbol(value) NanNew<v8::String>(value)
+
+ template<typename T>
+ NAN_INLINE void NanAssignPersistent(
+ v8::Persistent<T>& handle
+ , v8::Handle<T> obj) {
+ handle.Reset(nan_isolate, obj);
+ }
+
+ template<typename T>
+ NAN_INLINE void NanAssignPersistent(
+ v8::Persistent<T>& handle
+ , const v8::Persistent<T>& obj) {
+ handle.Reset(nan_isolate, obj);
+ }
+
+ template<typename T, typename P>
+ struct _NanWeakCallbackInfo {
+ typedef void (*Callback)(
+ const v8::WeakCallbackData<T, _NanWeakCallbackInfo<T, P> >& data);
+ _NanWeakCallbackInfo(v8::Handle<T> handle, P* param, Callback cb)
+ : parameter(param), callback(cb) {
+ NanAssignPersistent(persistent, handle);
+ }
+
+ ~_NanWeakCallbackInfo() {
+ persistent.Reset();
+ }
+
+ P* const parameter;
+ Callback const callback;
+ v8::Persistent<T> persistent;
+ };
+
+ template<typename T, typename P>
+ class _NanWeakCallbackData {
+ public:
+ _NanWeakCallbackData(_NanWeakCallbackInfo<T, P> *info)
+ : info_(info) { }
+
+ NAN_INLINE v8::Local<T> GetValue() const {
+ return NanNew(info_->persistent);
+ }
+ NAN_INLINE P* GetParameter() const { return info_->parameter; }
+ NAN_INLINE void Revive() const {
+ info_->persistent.SetWeak(info_, info_->callback);
+ }
+
+ NAN_INLINE void Dispose() const {
+ delete info_;
+ }
+
+ private:
+ _NanWeakCallbackInfo<T, P>* info_;
+ };
+
+// do not use for declaration
+# define NAN_WEAK_CALLBACK(name) \
+ template<typename T, typename P> \
+ static void name( \
+ const v8::WeakCallbackData<T, _NanWeakCallbackInfo<T, P> > &data) { \
+ _NanWeakCallbackData<T, P> wcbd( \
+ data.GetParameter()); \
+ _Nan_Weak_Callback_ ## name(wcbd); \
+ } \
+ \
+ template<typename T, typename P> \
+ NAN_INLINE void _Nan_Weak_Callback_ ## name( \
+ const _NanWeakCallbackData<T, P> &data)
+
+# define NanScope() v8::HandleScope scope(nan_isolate)
+# define NanEscapableScope() v8::EscapableHandleScope scope(nan_isolate)
+# define NanEscapeScope(val) scope.Escape(val)
+# define NanLocker() v8::Locker locker(nan_isolate)
+# define NanUnlocker() v8::Unlocker unlocker(nan_isolate)
+# define NanReturnValue(value) return args.GetReturnValue().Set(value)
+# define NanReturnUndefined() return
+# define NanReturnNull() return args.GetReturnValue().SetNull()
+# define NanReturnEmptyString() return args.GetReturnValue().SetEmptyString()
+
+# define NanObjectWrapHandle(obj) obj->handle()
+
+template<typename T, typename P>
+void NAN_INLINE NanMakeWeakPersistent(
+ v8::Handle<T> handle
+ , P* parameter
+ , typename _NanWeakCallbackInfo<T, P>::Callback callback) {
+ _NanWeakCallbackInfo<T, P> *cbinfo =
+ new _NanWeakCallbackInfo<T, P>(handle, parameter, callback);
+ cbinfo->persistent.SetWeak(cbinfo, callback);
+}
+
+# define _NAN_ERROR(fun, errmsg) fun(NanNew<v8::String>(errmsg))
+
+# define _NAN_THROW_ERROR(fun, errmsg) \
+ do { \
+ NanScope(); \
+ nan_isolate->ThrowException(_NAN_ERROR(fun, errmsg)); \
+ } while (0);
+
+ NAN_INLINE v8::Local<v8::Value> NanError(const char* errmsg) {
+ return _NAN_ERROR(v8::Exception::Error, errmsg);
+ }
+
+ NAN_INLINE void NanThrowError(const char* errmsg) {
+ _NAN_THROW_ERROR(v8::Exception::Error, errmsg);
+ }
+
+ NAN_INLINE void NanThrowError(v8::Handle<v8::Value> error) {
+ NanScope();
+ nan_isolate->ThrowException(error);
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanError(
+ const char *msg
+ , const int errorNumber
+ ) {
+ v8::Local<v8::Value> err = v8::Exception::Error(NanNew<v8::String>(msg));
+ v8::Local<v8::Object> obj = err.As<v8::Object>();
+ obj->Set(NanSymbol("code"), NanNew<v8::Integer>(errorNumber));
+ return err;
+ }
+
+ NAN_INLINE void NanThrowError(
+ const char *msg
+ , const int errorNumber
+ ) {
+ NanThrowError(NanError(msg, errorNumber));
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanTypeError(const char* errmsg) {
+ return _NAN_ERROR(v8::Exception::TypeError, errmsg);
+ }
+
+ NAN_INLINE void NanThrowTypeError(const char* errmsg) {
+ _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg);
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanRangeError(const char* errmsg) {
+ return _NAN_ERROR(v8::Exception::RangeError, errmsg);
+ }
+
+ NAN_INLINE void NanThrowRangeError(const char* errmsg) {
+ _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg);
+ }
+
+ template<typename T> NAN_INLINE void NanDisposePersistent(
+ v8::Persistent<T> &handle
+ ) {
+ handle.Reset();
+ }
+
+ NAN_INLINE v8::Local<v8::Object> NanNewBufferHandle (
+ char *data
+ , size_t length
+ , node::smalloc::FreeCallback callback
+ , void *hint
+ ) {
+ return node::Buffer::New(nan_isolate, data, length, callback, hint);
+ }
+
+ NAN_INLINE v8::Local<v8::Object> NanNewBufferHandle (
+ const char *data
+ , uint32_t size
+ ) {
+ return node::Buffer::New(nan_isolate, data, size);
+ }
+
+ NAN_INLINE v8::Local<v8::Object> NanNewBufferHandle (uint32_t size) {
+ return node::Buffer::New(nan_isolate, size);
+ }
+
+ NAN_INLINE v8::Local<v8::Object> NanBufferUse(
+ char* data
+ , uint32_t size
+ ) {
+ return node::Buffer::Use(nan_isolate, data, size);
+ }
+
+ NAN_INLINE bool NanHasInstance(
+ v8::Persistent<v8::FunctionTemplate>& function_template
+ , v8::Handle<v8::Value> value
+ ) {
+ return NanNew(function_template)->HasInstance(value);
+ }
+
+ NAN_INLINE v8::Local<v8::Context> NanNewContextHandle(
+ v8::ExtensionConfiguration* extensions = NULL
+ , v8::Handle<v8::ObjectTemplate> tmpl = v8::Handle<v8::ObjectTemplate>()
+ , v8::Handle<v8::Value> obj = v8::Handle<v8::Value>()
+ ) {
+ return v8::Local<v8::Context>::New(
+ nan_isolate
+ , v8::Context::New(nan_isolate, extensions, tmpl, obj)
+ );
+ }
+
+ NAN_INLINE v8::Local<NanBoundScript> NanCompileScript(
+ v8::Local<v8::String> s
+ , const v8::ScriptOrigin& origin
+ ) {
+ v8::ScriptCompiler::Source source(s, origin);
+ return v8::ScriptCompiler::Compile(nan_isolate, &source);
+ }
+
+ NAN_INLINE v8::Local<NanBoundScript> NanCompileScript(
+ v8::Local<v8::String> s
+ ) {
+ v8::ScriptCompiler::Source source(s);
+ return v8::ScriptCompiler::Compile(nan_isolate, &source);
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanRunScript(
+ v8::Local<NanUnboundScript> script
+ ) {
+ return script->BindToCurrentContext()->Run();
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanRunScript(
+ v8::Local<NanBoundScript> script
+ ) {
+ return script->Run();
+ }
+
+#else
+// Node 0.8 and 0.10
+
+# define _NAN_METHOD_ARGS_TYPE const v8::Arguments&
+# define _NAN_METHOD_ARGS _NAN_METHOD_ARGS_TYPE args
+# define _NAN_METHOD_RETURN_TYPE v8::Handle<v8::Value>
+
+# define _NAN_GETTER_ARGS_TYPE const v8::AccessorInfo &
+# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args
+# define _NAN_GETTER_RETURN_TYPE v8::Handle<v8::Value>
+
+# define _NAN_SETTER_ARGS_TYPE const v8::AccessorInfo &
+# define _NAN_SETTER_ARGS _NAN_SETTER_ARGS_TYPE args
+# define _NAN_SETTER_RETURN_TYPE void
+
+# define _NAN_PROPERTY_GETTER_ARGS_TYPE const v8::AccessorInfo&
+# define _NAN_PROPERTY_GETTER_ARGS _NAN_PROPERTY_GETTER_ARGS_TYPE args
+# define _NAN_PROPERTY_GETTER_RETURN_TYPE v8::Handle<v8::Value>
+
+# define _NAN_PROPERTY_SETTER_ARGS_TYPE const v8::AccessorInfo&
+# define _NAN_PROPERTY_SETTER_ARGS _NAN_PROPERTY_SETTER_ARGS_TYPE args
+# define _NAN_PROPERTY_SETTER_RETURN_TYPE v8::Handle<v8::Value>
+
+# define _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE const v8::AccessorInfo&
+# define _NAN_PROPERTY_ENUMERATOR_ARGS _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE args
+# define _NAN_PROPERTY_ENUMERATOR_RETURN_TYPE v8::Handle<v8::Array>
+
+# define _NAN_PROPERTY_DELETER_ARGS_TYPE const v8::AccessorInfo&
+# define _NAN_PROPERTY_DELETER_ARGS _NAN_PROPERTY_DELETER_ARGS_TYPE args
+# define _NAN_PROPERTY_DELETER_RETURN_TYPE v8::Handle<v8::Boolean>
+
+# define _NAN_PROPERTY_QUERY_ARGS_TYPE const v8::AccessorInfo&
+# define _NAN_PROPERTY_QUERY_ARGS _NAN_PROPERTY_QUERY_ARGS_TYPE args
+# define _NAN_PROPERTY_QUERY_RETURN_TYPE v8::Handle<v8::Integer>
+
+# define _NAN_INDEX_GETTER_ARGS_TYPE const v8::AccessorInfo&
+# define _NAN_INDEX_GETTER_ARGS _NAN_INDEX_GETTER_ARGS_TYPE args
+# define _NAN_INDEX_GETTER_RETURN_TYPE v8::Handle<v8::Value>
+
+# define _NAN_INDEX_SETTER_ARGS_TYPE const v8::AccessorInfo&
+# define _NAN_INDEX_SETTER_ARGS _NAN_INDEX_SETTER_ARGS_TYPE args
+# define _NAN_INDEX_SETTER_RETURN_TYPE v8::Handle<v8::Value>
+
+# define _NAN_INDEX_ENUMERATOR_ARGS_TYPE const v8::AccessorInfo&
+# define _NAN_INDEX_ENUMERATOR_ARGS _NAN_INDEX_ENUMERATOR_ARGS_TYPE args
+# define _NAN_INDEX_ENUMERATOR_RETURN_TYPE v8::Handle<v8::Array>
+
+# define _NAN_INDEX_DELETER_ARGS_TYPE const v8::AccessorInfo&
+# define _NAN_INDEX_DELETER_ARGS _NAN_INDEX_DELETER_ARGS_TYPE args
+# define _NAN_INDEX_DELETER_RETURN_TYPE v8::Handle<v8::Boolean>
+
+# define _NAN_INDEX_QUERY_ARGS_TYPE const v8::AccessorInfo&
+# define _NAN_INDEX_QUERY_ARGS _NAN_INDEX_QUERY_ARGS_TYPE args
+# define _NAN_INDEX_QUERY_RETURN_TYPE v8::Handle<v8::Integer>
+
+typedef v8::InvocationCallback NanFunctionCallback;
+
+# define NanUndefined() v8::Undefined()
+# define NanNull() v8::Null()
+# define NanTrue() v8::True()
+# define NanFalse() v8::False()
+# define NanAdjustExternalMemory(amount) \
+ v8::V8::AdjustAmountOfExternalAllocatedMemory(amount)
+# define NanSetTemplate(templ, name, value) templ->Set(name, value)
+# define NanGetCurrentContext() v8::Context::GetCurrent()
+# if NODE_VERSION_AT_LEAST(0, 8, 0)
+# define NanMakeCallback(target, func, argc, argv) \
+ node::MakeCallback(target, func, argc, argv)
+# else
+# define NanMakeCallback(target, func, argc, argv) \
+ do { \
+ v8::TryCatch try_catch; \
+ func->Call(target, argc, argv); \
+ if (try_catch.HasCaught()) { \
+ v8::FatalException(try_catch); \
+ } \
+ } while (0)
+# endif
+
+# define NanSymbol(value) v8::String::NewSymbol(value)
+
+ template<typename T>
+ NAN_INLINE v8::Local<T> NanNew() {
+ return v8::Local<T>::New(T::New());
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<T> NanNew(v8::Handle<T> arg) {
+ return v8::Local<T>::New(arg);
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<v8::Signature> NanNew(
+ v8::Handle<v8::FunctionTemplate> receiver
+ , int argc
+ , v8::Handle<v8::FunctionTemplate> argv[] = 0) {
+ return v8::Signature::New(receiver, argc, argv);
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<v8::FunctionTemplate> NanNew(
+ NanFunctionCallback callback
+ , v8::Handle<v8::Value> data = v8::Handle<v8::Value>()
+ , v8::Handle<v8::Signature> signature = v8::Handle<v8::Signature>()) {
+ return T::New(callback, data, signature);
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<T> NanNew(const v8::Persistent<T> &arg) {
+ return v8::Local<T>::New(arg);
+ }
+
+ template<typename T, typename P>
+ NAN_INLINE v8::Local<T> NanNew(P arg) {
+ return v8::Local<T>::New(T::New(arg));
+ }
+
+ template<typename T, typename P>
+ NAN_INLINE v8::Local<T> NanNew(P arg, int length) {
+ return v8::Local<T>::New(T::New(arg, length));
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<v8::RegExp> NanNew(
+ v8::Handle<v8::String> pattern, v8::RegExp::Flags flags) {
+ return v8::RegExp::New(pattern, flags);
+ }
+
+ template<typename T>
+ NAN_INLINE v8::Local<v8::RegExp> NanNew(
+ v8::Local<v8::String> pattern, v8::RegExp::Flags flags) {
+ return v8::RegExp::New(pattern, flags);
+ }
+
+ template<typename T, typename P>
+ NAN_INLINE v8::Local<v8::RegExp> NanNew(
+ v8::Handle<v8::String> pattern, v8::RegExp::Flags flags) {
+ return v8::RegExp::New(pattern, flags);
+ }
+
+ template<typename T, typename P>
+ NAN_INLINE v8::Local<v8::RegExp> NanNew(
+ v8::Local<v8::String> pattern, v8::RegExp::Flags flags) {
+ return v8::RegExp::New(pattern, flags);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Array> NanNew<v8::Array>() {
+ return v8::Array::New();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Array> NanNew<v8::Array>(int length) {
+ return v8::Array::New(length);
+ }
+
+
+ template<>
+ NAN_INLINE v8::Local<v8::Date> NanNew<v8::Date>(double time) {
+ return v8::Date::New(time).As<v8::Date>();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Date> NanNew<v8::Date>(int time) {
+ return v8::Date::New(time).As<v8::Date>();
+ }
+
+ typedef v8::Script NanUnboundScript;
+ typedef v8::Script NanBoundScript;
+
+ template<typename T, typename P>
+ NAN_INLINE v8::Local<T> NanNew(
+ P s
+ , const v8::ScriptOrigin& origin
+ ) {
+ return v8::Script::New(s, const_cast<v8::ScriptOrigin *>(&origin));
+ }
+
+ template<>
+ NAN_INLINE v8::Local<NanUnboundScript> NanNew<NanUnboundScript>(
+ v8::Local<v8::String> s
+ ) {
+ return v8::Script::New(s);
+ }
+
+ NAN_INLINE v8::Local<v8::String> NanNew(
+ v8::String::ExternalStringResource *resource) {
+ return v8::String::NewExternal(resource);
+ }
+
+ NAN_INLINE v8::Local<v8::String> NanNew(
+ v8::String::ExternalAsciiStringResource *resource) {
+ return v8::String::NewExternal(resource);
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::BooleanObject> NanNew(bool value) {
+ return v8::BooleanObject::New(value).As<v8::BooleanObject>();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::StringObject>
+ NanNew<v8::StringObject, v8::Local<v8::String> >(
+ v8::Local<v8::String> value) {
+ return v8::StringObject::New(value).As<v8::StringObject>();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::StringObject>
+ NanNew<v8::StringObject, v8::Handle<v8::String> >(
+ v8::Handle<v8::String> value) {
+ return v8::StringObject::New(value).As<v8::StringObject>();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::NumberObject> NanNew<v8::NumberObject>(double val) {
+ return v8::NumberObject::New(val).As<v8::NumberObject>();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Uint32> NanNew<v8::Uint32, int32_t>(int32_t val) {
+ return v8::Uint32::NewFromUnsigned(val)->ToUint32();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Uint32> NanNew<v8::Uint32, uint32_t>(uint32_t val) {
+ return v8::Uint32::NewFromUnsigned(val)->ToUint32();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Int32> NanNew<v8::Int32, int32_t>(int32_t val) {
+ return v8::Int32::New(val)->ToInt32();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::Int32> NanNew<v8::Int32, uint32_t>(uint32_t val) {
+ return v8::Int32::New(val)->ToInt32();
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, uint8_t *>(
+ uint8_t *arg
+ , int length) {
+ uint16_t *warg = new uint16_t[length];
+ for (int i = 0; i < length; i++) {
+ warg[i] = arg[i];
+ }
+ v8::Local<v8::String> retval = v8::String::New(warg, length);
+ delete[] warg;
+ return retval;
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const uint8_t *>(
+ const uint8_t *arg
+ , int length) {
+ uint16_t *warg = new uint16_t[length];
+ for (int i = 0; i < length; i++) {
+ warg[i] = arg[i];
+ }
+ v8::Local<v8::String> retval = v8::String::New(warg, length);
+ delete[] warg;
+ return retval;
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, uint8_t *>(uint8_t *arg) {
+ int length = strlen(reinterpret_cast<char *>(arg));
+ uint16_t *warg = new uint16_t[length];
+ for (int i = 0; i < length; i++) {
+ warg[i] = arg[i];
+ }
+
+ v8::Local<v8::String> retval = v8::String::New(warg, length);
+ delete[] warg;
+ return retval;
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String, const uint8_t *>(
+ const uint8_t *arg) {
+ int length = strlen(reinterpret_cast<const char *>(arg));
+ uint16_t *warg = new uint16_t[length];
+ for (int i = 0; i < length; i++) {
+ warg[i] = arg[i];
+ }
+ v8::Local<v8::String> retval = v8::String::New(warg, length);
+ delete[] warg;
+ return retval;
+ }
+
+ template<>
+ NAN_INLINE v8::Local<v8::String> NanNew<v8::String>() {
+ return v8::String::Empty();
+ }
+
+ NAN_INLINE void NanAddGCEpilogueCallback(
+ v8::GCEpilogueCallback callback
+ , v8::GCType gc_type_filter = v8::kGCTypeAll) {
+ v8::V8::AddGCEpilogueCallback(callback, gc_type_filter);
+ }
+ NAN_INLINE void NanRemoveGCEpilogueCallback(
+ v8::GCEpilogueCallback callback) {
+ v8::V8::RemoveGCEpilogueCallback(callback);
+ }
+ NAN_INLINE void NanAddGCPrologueCallback(
+ v8::GCPrologueCallback callback
+ , v8::GCType gc_type_filter = v8::kGCTypeAll) {
+ v8::V8::AddGCPrologueCallback(callback, gc_type_filter);
+ }
+ NAN_INLINE void NanRemoveGCPrologueCallback(
+ v8::GCPrologueCallback callback) {
+ v8::V8::RemoveGCPrologueCallback(callback);
+ }
+ NAN_INLINE void NanGetHeapStatistics(
+ v8::HeapStatistics *heap_statistics) {
+ v8::V8::GetHeapStatistics(heap_statistics);
+ }
+
+ template<typename T>
+ NAN_INLINE void NanAssignPersistent(
+ v8::Persistent<T>& handle
+ , v8::Handle<T> obj) {
+ handle.Dispose();
+ handle = v8::Persistent<T>::New(obj);
+ }
+
+ template<typename T, typename P>
+ struct _NanWeakCallbackInfo {
+ typedef void (*Callback)(v8::Persistent<v8::Value> object, void* parameter);
+ _NanWeakCallbackInfo(v8::Handle<T> handle, P* param, Callback cb) :
+ parameter(param)
+ , callback(cb)
+ , persistent(v8::Persistent<T>::New(handle)) { }
+
+ ~_NanWeakCallbackInfo() {
+ persistent.Dispose();
+ persistent.Clear();
+ }
+
+ P* const parameter;
+ Callback const callback;
+ v8::Persistent<T> persistent;
+ };
+
+ template<typename T, typename P>
+ class _NanWeakCallbackData {
+ public:
+ _NanWeakCallbackData(_NanWeakCallbackInfo<T, P> *info)
+ : info_(info) { }
+
+ NAN_INLINE v8::Local<T> GetValue() const {
+ return NanNew(info_->persistent);
+ }
+ NAN_INLINE P* GetParameter() const { return info_->parameter; }
+ NAN_INLINE void Revive() const {
+ info_->persistent.MakeWeak(info_, info_->callback);
+ }
+ NAN_INLINE void Dispose() const {
+ delete info_;
+ }
+
+ private:
+ _NanWeakCallbackInfo<T, P>* info_;
+ };
+
+# define NanGetInternalFieldPointer(object, index) \
+ object->GetPointerFromInternalField(index)
+# define NanSetInternalFieldPointer(object, index, value) \
+ object->SetPointerInInternalField(index, value)
+
+// do not use for declaration
+# define NAN_WEAK_CALLBACK(name) \
+ template<typename T, typename P> \
+ static void name( \
+ v8::Persistent<v8::Value> object, void *data) { \
+ _NanWeakCallbackData<T, P> wcbd( \
+ static_cast<_NanWeakCallbackInfo<T, P>*>(data)); \
+ _Nan_Weak_Callback_ ## name(wcbd); \
+ } \
+ \
+ template<typename T, typename P> \
+ NAN_INLINE void _Nan_Weak_Callback_ ## name( \
+ const _NanWeakCallbackData<T, P> &data)
+
+ template<typename T, typename P>
+ NAN_INLINE void NanMakeWeakPersistent(
+ v8::Handle<T> handle
+ , P* parameter
+ , typename _NanWeakCallbackInfo<T, P>::Callback callback) {
+ _NanWeakCallbackInfo<T, P> *cbinfo =
+ new _NanWeakCallbackInfo<T, P>(handle, parameter, callback);
+ cbinfo->persistent.MakeWeak(cbinfo, callback);
+ }
+
+# define NanScope() v8::HandleScope scope
+# define NanEscapableScope() v8::HandleScope scope
+# define NanEscapeScope(val) scope.Close(val)
+# define NanLocker() v8::Locker locker
+# define NanUnlocker() v8::Unlocker unlocker
+# define NanReturnValue(value) return scope.Close(value)
+# define NanReturnUndefined() return v8::Undefined()
+# define NanReturnNull() return v8::Null()
+# define NanReturnEmptyString() return v8::String::Empty()
+# define NanObjectWrapHandle(obj) v8::Local<v8::Object>::New(obj->handle_)
+
+# define _NAN_ERROR(fun, errmsg) \
+ fun(v8::String::New(errmsg))
+
+# define _NAN_THROW_ERROR(fun, errmsg) \
+ do { \
+ NanScope(); \
+ return v8::Local<v8::Value>::New( \
+ v8::ThrowException(_NAN_ERROR(fun, errmsg))); \
+ } while (0);
+
+ NAN_INLINE v8::Local<v8::Value> NanError(const char* errmsg) {
+ return _NAN_ERROR(v8::Exception::Error, errmsg);
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanThrowError(const char* errmsg) {
+ _NAN_THROW_ERROR(v8::Exception::Error, errmsg);
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanThrowError(
+ v8::Handle<v8::Value> error
+ ) {
+ NanScope();
+ return v8::Local<v8::Value>::New(v8::ThrowException(error));
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanError(
+ const char *msg
+ , const int errorNumber
+ ) {
+ v8::Local<v8::Value> err = v8::Exception::Error(v8::String::New(msg));
+ v8::Local<v8::Object> obj = err.As<v8::Object>();
+ obj->Set(v8::String::New("code"), v8::Int32::New(errorNumber));
+ return err;
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanThrowError(
+ const char *msg
+ , const int errorNumber
+ ) {
+ return NanThrowError(NanError(msg, errorNumber));
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanTypeError(const char* errmsg) {
+ return _NAN_ERROR(v8::Exception::TypeError, errmsg);
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanThrowTypeError(
+ const char* errmsg
+ ) {
+ _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg);
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanRangeError(
+ const char* errmsg
+ ) {
+ return _NAN_ERROR(v8::Exception::RangeError, errmsg);
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanThrowRangeError(
+ const char* errmsg
+ ) {
+ _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg);
+ }
+
+ template<typename T>
+ NAN_INLINE void NanDisposePersistent(
+ v8::Persistent<T> &handle) { // NOLINT(runtime/references)
+ handle.Dispose();
+ handle.Clear();
+ }
+
+ NAN_INLINE v8::Local<v8::Object> NanNewBufferHandle (
+ char *data
+ , size_t length
+ , node::Buffer::free_callback callback
+ , void *hint
+ ) {
+ return NanNew<v8::Object>(
+ node::Buffer::New(data, length, callback, hint)->handle_);
+ }
+
+ NAN_INLINE v8::Local<v8::Object> NanNewBufferHandle (
+ const char *data
+ , uint32_t size
+ ) {
+#if NODE_MODULE_VERSION >= 0x000B
+ return NanNew<v8::Object>(node::Buffer::New(data, size)->handle_);
+#else
+ return NanNew<v8::Object>(
+ node::Buffer::New(const_cast<char*>(data), size)->handle_);
+#endif
+ }
+
+ NAN_INLINE v8::Local<v8::Object> NanNewBufferHandle (uint32_t size) {
+ return NanNew<v8::Object>(node::Buffer::New(size)->handle_);
+ }
+
+ NAN_INLINE void FreeData(char *data, void *hint) {
+ delete[] data;
+ }
+
+ NAN_INLINE v8::Local<v8::Object> NanBufferUse(
+ char* data
+ , uint32_t size
+ ) {
+ return NanNew<v8::Object>(
+ node::Buffer::New(data, size, FreeData, NULL)->handle_);
+ }
+
+ NAN_INLINE bool NanHasInstance(
+ v8::Persistent<v8::FunctionTemplate>& function_template
+ , v8::Handle<v8::Value> value
+ ) {
+ return function_template->HasInstance(value);
+ }
+
+ NAN_INLINE v8::Local<v8::Context> NanNewContextHandle(
+ v8::ExtensionConfiguration* extensions = NULL
+ , v8::Handle<v8::ObjectTemplate> tmpl = v8::Handle<v8::ObjectTemplate>()
+ , v8::Handle<v8::Value> obj = v8::Handle<v8::Value>()
+ ) {
+ v8::Persistent<v8::Context> ctx = v8::Context::New(extensions, tmpl, obj);
+ v8::Local<v8::Context> lctx = NanNew<v8::Context>(ctx);
+ ctx.Dispose();
+ return lctx;
+ }
+
+ NAN_INLINE v8::Local<NanBoundScript> NanCompileScript(
+ v8::Local<v8::String> s
+ , const v8::ScriptOrigin& origin
+ ) {
+ return v8::Script::Compile(s, const_cast<v8::ScriptOrigin *>(&origin));
+ }
+
+ NAN_INLINE v8::Local<NanBoundScript> NanCompileScript(
+ v8::Local<v8::String> s
+ ) {
+ return v8::Script::Compile(s);
+ }
+
+ NAN_INLINE v8::Local<v8::Value> NanRunScript(v8::Local<v8::Script> script) {
+ return script->Run();
+ }
+
+#endif // NODE_MODULE_VERSION
+
+typedef void (*NanFreeCallback)(char *data, void *hint);
+
+#define NAN_METHOD(name) _NAN_METHOD_RETURN_TYPE name(_NAN_METHOD_ARGS)
+#define NAN_GETTER(name) \
+ _NAN_GETTER_RETURN_TYPE name( \
+ v8::Local<v8::String> property \
+ , _NAN_GETTER_ARGS)
+#define NAN_SETTER(name) \
+ _NAN_SETTER_RETURN_TYPE name( \
+ v8::Local<v8::String> property \
+ , v8::Local<v8::Value> value \
+ , _NAN_SETTER_ARGS)
+#define NAN_PROPERTY_GETTER(name) \
+ _NAN_PROPERTY_GETTER_RETURN_TYPE name( \
+ v8::Local<v8::String> property \
+ , _NAN_PROPERTY_GETTER_ARGS)
+#define NAN_PROPERTY_SETTER(name) \
+ _NAN_PROPERTY_SETTER_RETURN_TYPE name( \
+ v8::Local<v8::String> property \
+ , v8::Local<v8::Value> value \
+ , _NAN_PROPERTY_SETTER_ARGS)
+#define NAN_PROPERTY_ENUMERATOR(name) \
+ _NAN_PROPERTY_ENUMERATOR_RETURN_TYPE name(_NAN_PROPERTY_ENUMERATOR_ARGS)
+#define NAN_PROPERTY_DELETER(name) \
+ _NAN_PROPERTY_DELETER_RETURN_TYPE name( \
+ v8::Local<v8::String> property \
+ , _NAN_PROPERTY_DELETER_ARGS)
+#define NAN_PROPERTY_QUERY(name) \
+ _NAN_PROPERTY_QUERY_RETURN_TYPE name( \
+ v8::Local<v8::String> property \
+ , _NAN_PROPERTY_QUERY_ARGS)
+# define NAN_INDEX_GETTER(name) \
+ _NAN_INDEX_GETTER_RETURN_TYPE name(uint32_t index, _NAN_INDEX_GETTER_ARGS)
+#define NAN_INDEX_SETTER(name) \
+ _NAN_INDEX_SETTER_RETURN_TYPE name( \
+ uint32_t index \
+ , v8::Local<v8::Value> value \
+ , _NAN_INDEX_SETTER_ARGS)
+#define NAN_INDEX_ENUMERATOR(name) \
+ _NAN_INDEX_ENUMERATOR_RETURN_TYPE name(_NAN_INDEX_ENUMERATOR_ARGS)
+#define NAN_INDEX_DELETER(name) \
+ _NAN_INDEX_DELETER_RETURN_TYPE name( \
+ uint32_t index \
+ , _NAN_INDEX_DELETER_ARGS)
+#define NAN_INDEX_QUERY(name) \
+ _NAN_INDEX_QUERY_RETURN_TYPE name(uint32_t index, _NAN_INDEX_QUERY_ARGS)
+
+class NanCallback {
+ public:
+ NanCallback() {
+ NanScope();
+ v8::Local<v8::Object> obj = NanNew<v8::Object>();
+ NanAssignPersistent(handle, obj);
+ }
+
+ explicit NanCallback(const v8::Handle<v8::Function> &fn) {
+ NanScope();
+ v8::Local<v8::Object> obj = NanNew<v8::Object>();
+ NanAssignPersistent(handle, obj);
+ SetFunction(fn);
+ }
+
+ ~NanCallback() {
+ if (handle.IsEmpty()) return;
+ NanDisposePersistent(handle);
+ }
+
+ NAN_INLINE void SetFunction(const v8::Handle<v8::Function> &fn) {
+ NanScope();
+ NanNew(handle)->Set(NanSymbol("callback"), fn);
+ }
+
+ NAN_INLINE v8::Local<v8::Function> GetFunction () {
+ return NanNew(handle)->Get(NanSymbol("callback"))
+ .As<v8::Function>();
+ }
+
+ void Call(int argc, v8::Handle<v8::Value> argv[]) {
+ NanScope();
+#if (NODE_MODULE_VERSION > 0x000B) // 0.11.12+
+ v8::Local<v8::Function> callback = NanNew(handle)->
+ Get(NanSymbol("callback")).As<v8::Function>();
+ node::MakeCallback(
+ nan_isolate
+ , nan_isolate->GetCurrentContext()->Global()
+ , callback
+ , argc
+ , argv
+ );
+#else
+#if NODE_VERSION_AT_LEAST(0, 8, 0)
+ v8::Local<v8::Function> callback = NanNew(handle)->
+ Get(NanSymbol("callback")).As<v8::Function>();
+ node::MakeCallback(
+ v8::Context::GetCurrent()->Global()
+ , callback
+ , argc
+ , argv
+ );
+#else
+ node::MakeCallback(handle, "callback", argc, argv);
+#endif
+#endif
+ }
+
+ private:
+ v8::Persistent<v8::Object> handle;
+};
+
+/* abstract */ class NanAsyncWorker {
+ public:
+ explicit NanAsyncWorker(NanCallback *callback) : callback(callback) {
+ request.data = this;
+ errmsg = NULL;
+
+ NanScope();
+ v8::Local<v8::Object> obj = NanNew<v8::Object>();
+ NanAssignPersistent(persistentHandle, obj);
+ }
+
+ virtual ~NanAsyncWorker() {
+ NanScope();
+
+ if (!persistentHandle.IsEmpty())
+ NanDisposePersistent(persistentHandle);
+ if (callback)
+ delete callback;
+ if (errmsg)
+ delete errmsg;
+ }
+
+ virtual void WorkComplete() {
+ NanScope();
+
+ if (errmsg == NULL)
+ HandleOKCallback();
+ else
+ HandleErrorCallback();
+ delete callback;
+ callback = NULL;
+ }
+
+ NAN_INLINE void SaveToPersistent(const char *key, v8::Local<v8::Object> &obj) {
+ v8::Local<v8::Object> handle = NanNew(persistentHandle);
+ handle->Set(NanSymbol(key), obj);
+ }
+
+ v8::Local<v8::Object> GetFromPersistent(const char *key) {
+ NanEscapableScope();
+ v8::Local<v8::Object> handle = NanNew(persistentHandle);
+ return NanEscapeScope(handle->Get(NanSymbol(key)).As<v8::Object>());
+ }
+
+ virtual void Execute() = 0;
+
+ uv_work_t request;
+
+ protected:
+ v8::Persistent<v8::Object> persistentHandle;
+ NanCallback *callback;
+ const char *errmsg;
+
+ virtual void HandleOKCallback() {
+ NanScope();
+
+ callback->Call(0, NULL);
+ }
+
+ virtual void HandleErrorCallback() {
+ NanScope();
+
+ v8::Local<v8::Value> argv[] = {
+ v8::Exception::Error(NanNew<v8::String>(errmsg))
+ };
+ callback->Call(1, argv);
+ }
+};
+
+NAN_INLINE void NanAsyncExecute (uv_work_t* req) {
+ NanAsyncWorker *worker = static_cast<NanAsyncWorker*>(req->data);
+ worker->Execute();
+}
+
+NAN_INLINE void NanAsyncExecuteComplete (uv_work_t* req) {
+ NanAsyncWorker* worker = static_cast<NanAsyncWorker*>(req->data);
+ worker->WorkComplete();
+ delete worker;
+}
+
+NAN_INLINE void NanAsyncQueueWorker (NanAsyncWorker* worker) {
+ uv_queue_work(
+ uv_default_loop()
+ , &worker->request
+ , NanAsyncExecute
+ , (uv_after_work_cb)NanAsyncExecuteComplete
+ );
+}
+
+//// Base 64 ////
+
+#define _nan_base64_encoded_size(size) ((size + 2 - ((size + 2) % 3)) / 3 * 4)
+
+// Doesn't check for padding at the end. Can be 1-2 bytes over.
+NAN_INLINE size_t _nan_base64_decoded_size_fast(size_t size) {
+ size_t remainder = size % 4;
+
+ size = (size / 4) * 3;
+ if (remainder) {
+ if (size == 0 && remainder == 1) {
+ // special case: 1-byte input cannot be decoded
+ size = 0;
+ } else {
+ // non-padded input, add 1 or 2 extra bytes
+ size += 1 + (remainder == 3);
+ }
+ }
+
+ return size;
+}
+
+template<typename T>
+NAN_INLINE size_t _nan_base64_decoded_size(
+ const T* src
+ , size_t size
+) {
+ if (size == 0)
+ return 0;
+
+ if (src[size - 1] == '=')
+ size--;
+ if (size > 0 && src[size - 1] == '=')
+ size--;
+
+ return _nan_base64_decoded_size_fast(size);
+}
+
+// supports regular and URL-safe base64
+static const int _nan_unbase64_table[] = {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -2, -1, -1
+ , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+ , -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, 62, -1, 63
+ , 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1
+ , -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
+ , 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, 63
+ , -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40
+ , 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1
+ , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+ , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+ , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+ , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+ , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+ , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+ , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+ , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+};
+
+#define _nan_unbase64(x) _nan_unbase64_table[(uint8_t)(x)]
+
+template<typename T> static size_t _nan_base64_decode(
+ char* buf
+ , size_t len
+ , const T* src
+ , const size_t srcLen
+) {
+ char* dst = buf;
+ char* dstEnd = buf + len;
+ const T* srcEnd = src + srcLen;
+
+ while (src < srcEnd && dst < dstEnd) {
+ ptrdiff_t remaining = srcEnd - src;
+ char a, b, c, d;
+
+ while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--;
+ if (remaining == 0 || *src == '=') break;
+ a = _nan_unbase64(*src++);
+
+ while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--;
+ if (remaining <= 1 || *src == '=') break;
+ b = _nan_unbase64(*src++);
+
+ *dst++ = (a << 2) | ((b & 0x30) >> 4);
+ if (dst == dstEnd) break;
+
+ while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--;
+ if (remaining <= 2 || *src == '=') break;
+ c = _nan_unbase64(*src++);
+
+ *dst++ = ((b & 0x0F) << 4) | ((c & 0x3C) >> 2);
+ if (dst == dstEnd) break;
+
+ while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--;
+ if (remaining <= 3 || *src == '=') break;
+ d = _nan_unbase64(*src++);
+
+ *dst++ = ((c & 0x03) << 6) | (d & 0x3F);
+ }
+
+ return dst - buf;
+}
+
+//// HEX ////
+
+template<typename T> unsigned _nan_hex2bin(T c) {
+ if (c >= '0' && c <= '9') return c - '0';
+ if (c >= 'A' && c <= 'F') return 10 + (c - 'A');
+ if (c >= 'a' && c <= 'f') return 10 + (c - 'a');
+ return static_cast<unsigned>(-1);
+}
+
+template<typename T> static size_t _nan_hex_decode(
+ char* buf
+ , size_t len
+ , const T* src
+ , const size_t srcLen
+) {
+ size_t i;
+ for (i = 0; i < len && i * 2 + 1 < srcLen; ++i) {
+ unsigned a = _nan_hex2bin(src[i * 2 + 0]);
+ unsigned b = _nan_hex2bin(src[i * 2 + 1]);
+ if (!~a || !~b) return i;
+ buf[i] = a * 16 + b;
+ }
+
+ return i;
+}
+
+static bool _NanGetExternalParts(
+ v8::Handle<v8::Value> val
+ , const char** data
+ , size_t* len
+) {
+ if (node::Buffer::HasInstance(val)) {
+ *data = node::Buffer::Data(val.As<v8::Object>());
+ *len = node::Buffer::Length(val.As<v8::Object>());
+ return true;
+ }
+
+ assert(val->IsString());
+ v8::Local<v8::String> str = NanNew<v8::String>(val.As<v8::String>());
+
+ if (str->IsExternalAscii()) {
+ const v8::String::ExternalAsciiStringResource* ext;
+ ext = str->GetExternalAsciiStringResource();
+ *data = ext->data();
+ *len = ext->length();
+ return true;
+
+ } else if (str->IsExternal()) {
+ const v8::String::ExternalStringResource* ext;
+ ext = str->GetExternalStringResource();
+ *data = reinterpret_cast<const char*>(ext->data());
+ *len = ext->length();
+ return true;
+ }
+
+ return false;
+}
+
+namespace Nan {
+ enum Encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER};
+}
+
+NAN_INLINE void* NanRawString(
+ v8::Handle<v8::Value> from
+ , enum Nan::Encoding encoding
+ , size_t *datalen
+ , void *buf
+ , size_t buflen
+ , int flags
+) {
+ NanScope();
+
+ size_t sz_;
+ size_t term_len = !(flags & v8::String::NO_NULL_TERMINATION);
+ char *data = NULL;
+ size_t len;
+ bool is_extern = _NanGetExternalParts(
+ from
+ , const_cast<const char**>(&data)
+ , &len);
+
+ if (is_extern && !term_len) {
+ NanSetPointerSafe(datalen, len);
+ return data;
+ }
+
+ v8::Local<v8::String> toStr = from->ToString();
+
+ char *to = static_cast<char *>(buf);
+
+ switch (encoding) {
+ case Nan::ASCII:
+#if NODE_MODULE_VERSION < 0x000C
+ sz_ = toStr->Length();
+ if (to == NULL) {
+ to = new char[sz_ + term_len];
+ } else {
+ assert(buflen >= sz_ + term_len && "too small buffer");
+ }
+ NanSetPointerSafe<size_t>(
+ datalen
+ , toStr->WriteAscii(to, 0, static_cast<int>(sz_ + term_len), flags));
+ return to;
+#endif
+ case Nan::BINARY:
+ case Nan::BUFFER:
+ sz_ = toStr->Length();
+ if (to == NULL) {
+ to = new char[sz_ + term_len];
+ } else {
+ assert(buflen >= sz_ + term_len && "too small buffer");
+ }
+#if NODE_MODULE_VERSION < 0x000C
+ {
+ uint16_t* twobytebuf = new uint16_t[sz_ + term_len];
+
+ size_t len = toStr->Write(twobytebuf, 0,
+ static_cast<int>(sz_ + term_len), flags);
+
+ for (size_t i = 0; i < sz_ + term_len && i < len + term_len; i++) {
+ unsigned char *b = reinterpret_cast<unsigned char*>(&twobytebuf[i]);
+ to[i] = *b;
+ }
+
+ NanSetPointerSafe<size_t>(datalen, len);
+
+ delete[] twobytebuf;
+ return to;
+ }
+#else
+ NanSetPointerSafe<size_t>(
+ datalen,
+ toStr->WriteOneByte(
+ reinterpret_cast<uint8_t *>(to)
+ , 0
+ , static_cast<int>(sz_ + term_len)
+ , flags));
+ return to;
+#endif
+ case Nan::UTF8:
+ sz_ = toStr->Utf8Length();
+ if (to == NULL) {
+ to = new char[sz_ + term_len];
+ } else {
+ assert(buflen >= sz_ + term_len && "too small buffer");
+ }
+ NanSetPointerSafe<size_t>(
+ datalen
+ , toStr->WriteUtf8(to, static_cast<int>(sz_ + term_len)
+ , NULL, flags)
+ - term_len);
+ return to;
+ case Nan::BASE64:
+ {
+ v8::String::Value value(toStr);
+ sz_ = _nan_base64_decoded_size(*value, value.length());
+ if (to == NULL) {
+ to = new char[sz_ + term_len];
+ } else {
+ assert(buflen >= sz_ + term_len);
+ }
+ NanSetPointerSafe<size_t>(
+ datalen
+ , _nan_base64_decode(to, sz_, *value, value.length()));
+ if (term_len) {
+ to[sz_] = '\0';
+ }
+ return to;
+ }
+ case Nan::UCS2:
+ {
+ sz_ = toStr->Length();
+ if (to == NULL) {
+ to = new char[(sz_ + term_len) * 2];
+ } else {
+ assert(buflen >= (sz_ + term_len) * 2 && "too small buffer");
+ }
+
+ int bc = 2 * toStr->Write(
+ reinterpret_cast<uint16_t *>(to)
+ , 0
+ , static_cast<int>(sz_ + term_len)
+ , flags);
+ NanSetPointerSafe<size_t>(datalen, bc);
+ return to;
+ }
+ case Nan::HEX:
+ {
+ v8::String::Value value(toStr);
+ sz_ = value.length();
+ assert(!(sz_ & 1) && "bad hex data");
+ if (to == NULL) {
+ to = new char[sz_ / 2 + term_len];
+ } else {
+ assert(buflen >= sz_ / 2 + term_len && "too small buffer");
+ }
+ NanSetPointerSafe<size_t>(
+ datalen
+ , _nan_hex_decode(to, sz_ / 2, *value, value.length()));
+ }
+ if (term_len) {
+ to[sz_ / 2] = '\0';
+ }
+ return to;
+ default:
+ assert(0 && "unknown encoding");
+ }
+ return to;
+}
+
+NAN_INLINE char* NanCString(
+ v8::Handle<v8::Value> from
+ , size_t *datalen
+ , char *buf = NULL
+ , size_t buflen = 0
+ , int flags = v8::String::NO_OPTIONS
+) {
+ return static_cast<char *>(
+ NanRawString(from, Nan::UTF8, datalen, buf, buflen, flags)
+ );
+}
+
+#endif // NAN_H_
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/package.json b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/package.json
new file mode 100644
index 0000000..cae1811
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/nan/package.json
@@ -0,0 +1,67 @@
+{
+ "name": "nan",
+ "version": "1.0.0",
+ "description": "Native Abstractions for Node.js: C++ header for Node 0.8->0.12 compatibility",
+ "main": "include_dirs.js",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/rvagg/nan.git"
+ },
+ "contributors": [
+ {
+ "name": "Rod Vagg",
+ "email": "r@va.gg",
+ "url": "https://github.com/rvagg"
+ },
+ {
+ "name": "Benjamin Byholm",
+ "email": "bbyholm@abo.fi",
+ "url": "https://github.com/kkoopa/"
+ },
+ {
+ "name": "Trevor Norris",
+ "email": "trev.norris@gmail.com",
+ "url": "https://github.com/trevnorris"
+ },
+ {
+ "name": "Nathan Rajlich",
+ "email": "nathan@tootallnate.net",
+ "url": "https://github.com/TooTallNate"
+ },
+ {
+ "name": "Brett Lawson",
+ "email": "brett19@gmail.com",
+ "url": "https://github.com/brett19"
+ },
+ {
+ "name": "Ben Noordhuis",
+ "email": "info@bnoordhuis.nl",
+ "url": "https://github.com/bnoordhuis"
+ }
+ ],
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/rvagg/nan/issues"
+ },
+ "homepage": "https://github.com/rvagg/nan",
+ "_id": "nan@1.0.0",
+ "dist": {
+ "shasum": "ae24f8850818d662fcab5acf7f3b95bfaa2ccf38",
+ "tarball": "http://registry.npmjs.org/nan/-/nan-1.0.0.tgz"
+ },
+ "_from": "nan@~1.0.0",
+ "_npmVersion": "1.4.3",
+ "_npmUser": {
+ "name": "rvagg",
+ "email": "rod@vagg.org"
+ },
+ "maintainers": [
+ {
+ "name": "rvagg",
+ "email": "rod@vagg.org"
+ }
+ ],
+ "directories": {},
+ "_shasum": "ae24f8850818d662fcab5acf7f3b95bfaa2ccf38",
+ "_resolved": "https://registry.npmjs.org/nan/-/nan-1.0.0.tgz"
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/.npmignore b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/.npmignore
new file mode 100644
index 0000000..1b18fb3
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/.npmignore
@@ -0,0 +1,7 @@
+npm-debug.log
+node_modules
+.*.swp
+.lock-*
+build/
+
+test
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/Makefile b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/Makefile
new file mode 100644
index 0000000..7496b6f
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/Makefile
@@ -0,0 +1,12 @@
+ALL_TESTS = $(shell find test/ -name '*.test.js')
+
+run-tests:
+ @./node_modules/.bin/mocha \
+ -t 2000 \
+ $(TESTFLAGS) \
+ $(TESTS)
+
+test:
+ @$(MAKE) NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests
+
+.PHONY: test
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/README.md b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/README.md
new file mode 100644
index 0000000..0dabc75
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/README.md
@@ -0,0 +1,69 @@
+# options.js #
+
+A very light-weight in-code option parsers for node.js.
+
+## Usage ##
+
+``` js
+var Options = require("options");
+
+// Create an Options object
+function foo(options) {
+ var default_options = {
+ foo : "bar"
+ };
+
+ // Create an option object with default value
+ var opts = new Options(default_options);
+
+ // Merge options
+ opts = opts.merge(options);
+
+ // Reset to default value
+ opts.reset();
+
+ // Copy selected attributes out
+ var seled_att = opts.copy("foo");
+
+ // Read json options from a file.
+ opts.read("options.file"); // Sync
+ opts.read("options.file", function(err){ // Async
+ if(err){ // If error occurs
+ console.log("File error.");
+ }else{
+ // No error
+ }
+ });
+
+ // Attributes defined or not
+ opts.isDefinedAndNonNull("foobar");
+ opts.isDefined("foobar");
+}
+
+```
+
+
+## License ##
+
+(The MIT License)
+
+Copyright (c) 2012 Einar Otto Stangvik &lt;einaros@gmail.com&gt;
+
+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.
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/lib/options.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/lib/options.js
new file mode 100644
index 0000000..4fc45e9
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/lib/options.js
@@ -0,0 +1,86 @@
+/*!
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var fs = require('fs');
+
+function Options(defaults) {
+ var internalValues = {};
+ var values = this.value = {};
+ Object.keys(defaults).forEach(function(key) {
+ internalValues[key] = defaults[key];
+ Object.defineProperty(values, key, {
+ get: function() { return internalValues[key]; },
+ configurable: false,
+ enumerable: true
+ });
+ });
+ this.reset = function() {
+ Object.keys(defaults).forEach(function(key) {
+ internalValues[key] = defaults[key];
+ });
+ return this;
+ };
+ this.merge = function(options, required) {
+ options = options || {};
+ if (Object.prototype.toString.call(required) === '[object Array]') {
+ var missing = [];
+ for (var i = 0, l = required.length; i < l; ++i) {
+ var key = required[i];
+ if (!(key in options)) {
+ missing.push(key);
+ }
+ }
+ if (missing.length > 0) {
+ if (missing.length > 1) {
+ throw new Error('options ' +
+ missing.slice(0, missing.length - 1).join(', ') + ' and ' +
+ missing[missing.length - 1] + ' must be defined');
+ }
+ else throw new Error('option ' + missing[0] + ' must be defined');
+ }
+ }
+ Object.keys(options).forEach(function(key) {
+ if (key in internalValues) {
+ internalValues[key] = options[key];
+ }
+ });
+ return this;
+ };
+ this.copy = function(keys) {
+ var obj = {};
+ Object.keys(defaults).forEach(function(key) {
+ if (keys.indexOf(key) !== -1) {
+ obj[key] = values[key];
+ }
+ });
+ return obj;
+ };
+ this.read = function(filename, cb) {
+ if (typeof cb == 'function') {
+ var self = this;
+ fs.readFile(filename, function(error, data) {
+ if (error) return cb(error);
+ var conf = JSON.parse(data);
+ self.merge(conf);
+ cb();
+ });
+ }
+ else {
+ var conf = JSON.parse(fs.readFileSync(filename));
+ this.merge(conf);
+ }
+ return this;
+ };
+ this.isDefined = function(key) {
+ return typeof values[key] != 'undefined';
+ };
+ this.isDefinedAndNonNull = function(key) {
+ return typeof values[key] != 'undefined' && values[key] !== null;
+ };
+ Object.freeze(values);
+ Object.freeze(this);
+}
+
+module.exports = Options;
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/package.json b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/package.json
new file mode 100644
index 0000000..8c9e173
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/options/package.json
@@ -0,0 +1,50 @@
+{
+ "author": {
+ "name": "Einar Otto Stangvik",
+ "email": "einaros@gmail.com",
+ "url": "http://2x.io"
+ },
+ "name": "options",
+ "description": "A very light-weight in-code option parsers for node.js.",
+ "version": "0.0.6",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/einaros/options.js.git"
+ },
+ "main": "lib/options",
+ "scripts": {
+ "test": "make test"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "mocha": "latest"
+ },
+ "gitHead": "ff53d0a092c897cb95964232a96fe17da65c11af",
+ "bugs": {
+ "url": "https://github.com/einaros/options.js/issues"
+ },
+ "homepage": "https://github.com/einaros/options.js",
+ "_id": "options@0.0.6",
+ "_shasum": "ec22d312806bb53e731773e7cdaefcf1c643128f",
+ "_from": "options@>=0.0.5",
+ "_npmVersion": "1.4.21",
+ "_npmUser": {
+ "name": "einaros",
+ "email": "einaros@gmail.com"
+ },
+ "maintainers": [
+ {
+ "name": "einaros",
+ "email": "einaros@gmail.com"
+ }
+ ],
+ "dist": {
+ "shasum": "ec22d312806bb53e731773e7cdaefcf1c643128f",
+ "tarball": "http://registry.npmjs.org/options/-/options-0.0.6.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/options/-/options-0.0.6.tgz"
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/.npmignore b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/.npmignore
new file mode 100644
index 0000000..6bfffbb
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/.npmignore
@@ -0,0 +1,5 @@
+npm-debug.log
+node_modules
+.*.swp
+.lock-*
+build/
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/README.md b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/README.md
new file mode 100644
index 0000000..55eb3c1
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/README.md
@@ -0,0 +1,3 @@
+# tinycolor #
+
+This is a no-fuzz, barebone, zero muppetry color module for node.js. \ No newline at end of file
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/example.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/example.js
new file mode 100644
index 0000000..f754046
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/example.js
@@ -0,0 +1,3 @@
+require('./tinycolor');
+console.log('this should be red and have an underline!'.grey.underline);
+console.log('this should have a blue background!'.bgBlue); \ No newline at end of file
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/package.json b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/package.json
new file mode 100644
index 0000000..50ec0ac
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/package.json
@@ -0,0 +1,43 @@
+{
+ "author": {
+ "name": "Einar Otto Stangvik",
+ "email": "einaros@gmail.com",
+ "url": "http://2x.io"
+ },
+ "name": "tinycolor",
+ "description": "a to-the-point color module for node",
+ "version": "0.0.1",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/einaros/tinycolor.git"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ },
+ "dependencies": {},
+ "devDependencies": {},
+ "main": "tinycolor",
+ "_npmUser": {
+ "name": "einaros",
+ "email": "einaros@gmail.com"
+ },
+ "_id": "tinycolor@0.0.1",
+ "_engineSupported": true,
+ "_npmVersion": "1.1.0-alpha-6",
+ "_nodeVersion": "v0.6.5",
+ "_defaultsLoaded": true,
+ "dist": {
+ "shasum": "320b5a52d83abb5978d81a3e887d4aefb15a6164",
+ "tarball": "http://registry.npmjs.org/tinycolor/-/tinycolor-0.0.1.tgz"
+ },
+ "maintainers": [
+ {
+ "name": "einaros",
+ "email": "einaros@gmail.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "320b5a52d83abb5978d81a3e887d4aefb15a6164",
+ "_from": "tinycolor@0.x",
+ "_resolved": "https://registry.npmjs.org/tinycolor/-/tinycolor-0.0.1.tgz"
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/tinycolor.js b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/tinycolor.js
new file mode 100644
index 0000000..36e552c
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/node_modules/tinycolor/tinycolor.js
@@ -0,0 +1,31 @@
+var styles = {
+ 'bold': ['\033[1m', '\033[22m'],
+ 'italic': ['\033[3m', '\033[23m'],
+ 'underline': ['\033[4m', '\033[24m'],
+ 'inverse': ['\033[7m', '\033[27m'],
+ 'black': ['\033[30m', '\033[39m'],
+ 'red': ['\033[31m', '\033[39m'],
+ 'green': ['\033[32m', '\033[39m'],
+ 'yellow': ['\033[33m', '\033[39m'],
+ 'blue': ['\033[34m', '\033[39m'],
+ 'magenta': ['\033[35m', '\033[39m'],
+ 'cyan': ['\033[36m', '\033[39m'],
+ 'white': ['\033[37m', '\033[39m'],
+ 'default': ['\033[39m', '\033[39m'],
+ 'grey': ['\033[90m', '\033[39m'],
+ 'bgBlack': ['\033[40m', '\033[49m'],
+ 'bgRed': ['\033[41m', '\033[49m'],
+ 'bgGreen': ['\033[42m', '\033[49m'],
+ 'bgYellow': ['\033[43m', '\033[49m'],
+ 'bgBlue': ['\033[44m', '\033[49m'],
+ 'bgMagenta': ['\033[45m', '\033[49m'],
+ 'bgCyan': ['\033[46m', '\033[49m'],
+ 'bgWhite': ['\033[47m', '\033[49m'],
+ 'bgDefault': ['\033[49m', '\033[49m']
+}
+Object.keys(styles).forEach(function(style) {
+ Object.defineProperty(String.prototype, style, {
+ get: function() { return styles[style][0] + this + styles[style][1]; },
+ enumerable: false
+ });
+});
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/package.json b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/package.json
new file mode 100644
index 0000000..674db52
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/package.json
@@ -0,0 +1,81 @@
+{
+ "author": {
+ "name": "Einar Otto Stangvik",
+ "email": "einaros@gmail.com",
+ "url": "http://2x.io"
+ },
+ "name": "ws",
+ "description": "simple to use, blazing fast and thoroughly tested websocket client, server and console for node.js, up-to-date against RFC-6455",
+ "version": "0.4.32",
+ "keywords": [
+ "Hixie",
+ "HyBi",
+ "Push",
+ "RFC-6455",
+ "WebSocket",
+ "WebSockets",
+ "real-time"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/einaros/ws.git"
+ },
+ "bin": {
+ "wscat": "./bin/wscat"
+ },
+ "scripts": {
+ "test": "make test",
+ "install": "(node-gyp rebuild 2> builderror.log) || (exit 0)"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ },
+ "dependencies": {
+ "commander": "~2.1.0",
+ "nan": "~1.0.0",
+ "tinycolor": "0.x",
+ "options": ">=0.0.5"
+ },
+ "devDependencies": {
+ "mocha": "1.12.0",
+ "should": "1.2.x",
+ "expect.js": "0.2.x",
+ "benchmark": "0.3.x",
+ "ansi": "latest"
+ },
+ "browser": "./lib/browser.js",
+ "component": {
+ "scripts": {
+ "ws/index.js": "./lib/browser.js"
+ }
+ },
+ "gypfile": true,
+ "bugs": {
+ "url": "https://github.com/einaros/ws/issues"
+ },
+ "homepage": "https://github.com/einaros/ws",
+ "_id": "ws@0.4.32",
+ "_shasum": "787a6154414f3c99ed83c5772153b20feb0cec32",
+ "_from": "ws@0.4.x",
+ "_npmVersion": "1.4.10",
+ "_npmUser": {
+ "name": "V1",
+ "email": "info@3rd-Eden.com"
+ },
+ "maintainers": [
+ {
+ "name": "einaros",
+ "email": "einaros@gmail.com"
+ },
+ {
+ "name": "V1",
+ "email": "info@3rd-Eden.com"
+ }
+ ],
+ "dist": {
+ "shasum": "787a6154414f3c99ed83c5772153b20feb0cec32",
+ "tarball": "http://registry.npmjs.org/ws/-/ws-0.4.32.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/ws/-/ws-0.4.32.tgz"
+}
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/src/bufferutil.cc b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/src/bufferutil.cc
new file mode 100644
index 0000000..7f99bd6
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/src/bufferutil.cc
@@ -0,0 +1,117 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+#include <v8.h>
+#include <node.h>
+#include <node_buffer.h>
+#include <node_object_wrap.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+#include <stdio.h>
+#include "nan.h"
+
+using namespace v8;
+using namespace node;
+
+class BufferUtil : public ObjectWrap
+{
+public:
+
+ static void Initialize(v8::Handle<v8::Object> target)
+ {
+ NanScope();
+ Local<FunctionTemplate> t = NanNew<FunctionTemplate>(New);
+ t->InstanceTemplate()->SetInternalFieldCount(1);
+ NODE_SET_METHOD(t, "unmask", BufferUtil::Unmask);
+ NODE_SET_METHOD(t, "mask", BufferUtil::Mask);
+ NODE_SET_METHOD(t, "merge", BufferUtil::Merge);
+ target->Set(NanSymbol("BufferUtil"), t->GetFunction());
+ }
+
+protected:
+
+ static NAN_METHOD(New)
+ {
+ NanScope();
+ BufferUtil* bufferUtil = new BufferUtil();
+ bufferUtil->Wrap(args.This());
+ NanReturnValue(args.This());
+ }
+
+ static NAN_METHOD(Merge)
+ {
+ NanScope();
+ Local<Object> bufferObj = args[0]->ToObject();
+ char* buffer = Buffer::Data(bufferObj);
+ Local<Array> array = Local<Array>::Cast(args[1]);
+ unsigned int arrayLength = array->Length();
+ size_t offset = 0;
+ unsigned int i;
+ for (i = 0; i < arrayLength; ++i) {
+ Local<Object> src = array->Get(i)->ToObject();
+ size_t length = Buffer::Length(src);
+ memcpy(buffer + offset, Buffer::Data(src), length);
+ offset += length;
+ }
+ NanReturnValue(NanTrue());
+ }
+
+ static NAN_METHOD(Unmask)
+ {
+ NanScope();
+ Local<Object> buffer_obj = args[0]->ToObject();
+ size_t length = Buffer::Length(buffer_obj);
+ Local<Object> mask_obj = args[1]->ToObject();
+ unsigned int *mask = (unsigned int*)Buffer::Data(mask_obj);
+ unsigned int* from = (unsigned int*)Buffer::Data(buffer_obj);
+ size_t len32 = length / 4;
+ unsigned int i;
+ for (i = 0; i < len32; ++i) *(from + i) ^= *mask;
+ from += i;
+ switch (length % 4) {
+ case 3: *((unsigned char*)from+2) = *((unsigned char*)from+2) ^ ((unsigned char*)mask)[2];
+ case 2: *((unsigned char*)from+1) = *((unsigned char*)from+1) ^ ((unsigned char*)mask)[1];
+ case 1: *((unsigned char*)from ) = *((unsigned char*)from ) ^ ((unsigned char*)mask)[0];
+ case 0:;
+ }
+ NanReturnValue(NanTrue());
+ }
+
+ static NAN_METHOD(Mask)
+ {
+ NanScope();
+ Local<Object> buffer_obj = args[0]->ToObject();
+ Local<Object> mask_obj = args[1]->ToObject();
+ unsigned int *mask = (unsigned int*)Buffer::Data(mask_obj);
+ Local<Object> output_obj = args[2]->ToObject();
+ unsigned int dataOffset = args[3]->Int32Value();
+ unsigned int length = args[4]->Int32Value();
+ unsigned int* to = (unsigned int*)(Buffer::Data(output_obj) + dataOffset);
+ unsigned int* from = (unsigned int*)Buffer::Data(buffer_obj);
+ unsigned int len32 = length / 4;
+ unsigned int i;
+ for (i = 0; i < len32; ++i) *(to + i) = *(from + i) ^ *mask;
+ to += i;
+ from += i;
+ switch (length % 4) {
+ case 3: *((unsigned char*)to+2) = *((unsigned char*)from+2) ^ *((unsigned char*)mask+2);
+ case 2: *((unsigned char*)to+1) = *((unsigned char*)from+1) ^ *((unsigned char*)mask+1);
+ case 1: *((unsigned char*)to ) = *((unsigned char*)from ) ^ *((unsigned char*)mask);
+ case 0:;
+ }
+ NanReturnValue(NanTrue());
+ }
+};
+
+extern "C" void init (Handle<Object> target)
+{
+ NanScope();
+ BufferUtil::Initialize(target);
+}
+
+NODE_MODULE(bufferutil, init)
+
diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/src/validation.cc b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/src/validation.cc
new file mode 100644
index 0000000..0d9e242
--- /dev/null
+++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/src/validation.cc
@@ -0,0 +1,145 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+#include <v8.h>
+#include <node.h>
+#include <node_buffer.h>
+#include <node_object_wrap.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <stdio.h>
+#include "nan.h"
+
+using namespace v8;
+using namespace node;
+
+#define UNI_SUR_HIGH_START (uint32_t) 0xD800
+#define UNI_SUR_LOW_END (uint32_t) 0xDFFF
+#define UNI_REPLACEMENT_CHAR (uint32_t) 0x0000FFFD
+#define UNI_MAX_LEGAL_UTF32 (uint32_t) 0x0010FFFF
+
+static const uint8_t trailingBytesForUTF8[256] = {
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
+};
+
+static const uint32_t offsetsFromUTF8[6] = {
+ 0x00000000, 0x00003080, 0x000E2080,
+ 0x03C82080, 0xFA082080, 0x82082080
+};
+
+static int isLegalUTF8(const uint8_t *source, const int length)
+{
+ uint8_t a;
+ const uint8_t *srcptr = source+length;
+ switch (length) {
+ default: return 0;
+ /* Everything else falls through when "true"... */
+ /* RFC3629 makes 5 & 6 bytes UTF-8 illegal
+ case 6: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0;
+ case 5: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; */
+ case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0;
+ case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0;
+ case 2: if ((a = (*--srcptr)) > 0xBF) return 0;
+ switch (*source) {
+ /* no fall-through in this inner switch */
+ case 0xE0: if (a < 0xA0) return 0; break;
+ case 0xED: if (a > 0x9F) return 0; break;
+ case 0xF0: if (a < 0x90) return 0; break;
+ case 0xF4: if (a > 0x8F) return 0; break;
+ default: if (a < 0x80) return 0;
+ }
+
+ case 1: if (*source >= 0x80 && *source < 0xC2) return 0;
+ }
+ if (*source > 0xF4) return 0;
+ return 1;
+}
+
+int is_valid_utf8 (size_t len, char *value)
+{
+ /* is the string valid UTF-8? */
+ for (unsigned int i = 0; i < len; i++) {
+ uint32_t ch = 0;
+ uint8_t extrabytes = trailingBytesForUTF8[(uint8_t) value[i]];
+
+ if (extrabytes + i >= len)
+ return 0;
+
+ if (isLegalUTF8 ((uint8_t *) (value + i), extrabytes + 1) == 0) return 0;
+
+ switch (extrabytes) {
+ case 5 : ch += (uint8_t) value[i++]; ch <<= 6;
+ case 4 : ch += (uint8_t) value[i++]; ch <<= 6;
+ case 3 : ch += (uint8_t) value[i++]; ch <<= 6;
+ case 2 : ch += (uint8_t) value[i++]; ch <<= 6;
+ case 1 : ch += (uint8_t) value[i++]; ch <<= 6;
+ case 0 : ch += (uint8_t) value[i];
+ }
+
+ ch -= offsetsFromUTF8[extrabytes];
+
+ if (ch <= UNI_MAX_LEGAL_UTF32) {
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END)
+ return 0;
+ } else {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+class Validation : public ObjectWrap
+{
+public:
+
+ static void Initialize(v8::Handle<v8::Object> target)
+ {
+ NanScope();
+ Local<FunctionTemplate> t = NanNew<FunctionTemplate>(New);
+ t->InstanceTemplate()->SetInternalFieldCount(1);
+ NODE_SET_METHOD(t, "isValidUTF8", Validation::IsValidUTF8);
+ target->Set(NanSymbol("Validation"), t->GetFunction());
+ }
+
+protected:
+
+ static NAN_METHOD(New)
+ {
+ NanScope();
+ Validation* validation = new Validation();
+ validation->Wrap(args.This());
+ NanReturnValue(args.This());
+ }
+
+ static NAN_METHOD(IsValidUTF8)
+ {
+ NanScope();
+ if (!Buffer::HasInstance(args[0])) {
+ return NanThrowTypeError("First argument needs to be a buffer");
+ }
+ Local<Object> buffer_obj = args[0]->ToObject();
+ char *buffer_data = Buffer::Data(buffer_obj);
+ size_t buffer_length = Buffer::Length(buffer_obj);
+ NanReturnValue(is_valid_utf8(buffer_length, buffer_data) == 1 ? NanTrue() : NanFalse());
+ }
+};
+
+extern "C" void init (Handle<Object> target)
+{
+ NanScope();
+ Validation::Initialize(target);
+}
+
+NODE_MODULE(validation, init)
+