├── .gitignore ├── README.md ├── assets ├── css │ └── styles.css └── js │ └── main.js ├── haproxy.cfg ├── index.html ├── package.json ├── server.js ├── src ├── prod │ ├── assets │ │ ├── css │ │ │ └── styles.css │ │ └── js │ │ │ └── main.js │ ├── haproxy.cfg │ ├── index.html │ ├── node_modules │ │ ├── double-ended-queue │ │ │ ├── .npmignore │ │ │ ├── Gruntfile.js │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── js │ │ │ │ └── deque.js │ │ │ └── package.json │ │ ├── options │ │ │ ├── .npmignore │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── lib │ │ │ │ └── options.js │ │ │ └── package.json │ │ ├── redis-commands │ │ │ ├── .npmignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── changelog.md │ │ │ ├── commands.json │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ ├── test │ │ │ │ └── index.js │ │ │ └── tools │ │ │ │ └── build.js │ │ ├── redis-parser │ │ │ ├── .codeclimate.yml │ │ │ ├── .npmignore │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── changelog.md │ │ │ ├── index.js │ │ │ ├── lib │ │ │ │ ├── hiredis.js │ │ │ │ ├── parser.js │ │ │ │ └── replyError.js │ │ │ └── package.json │ │ ├── redis │ │ │ ├── .eslintignore │ │ │ ├── .eslintrc │ │ │ ├── .github │ │ │ │ ├── ISSUE_TEMPLATE.md │ │ │ │ └── PULL_REQUEST_TEMPLATE.md │ │ │ ├── .npmignore │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── changelog.md │ │ │ ├── index.js │ │ │ ├── lib │ │ │ │ ├── command.js │ │ │ │ ├── commands.js │ │ │ │ ├── createClient.js │ │ │ │ ├── customErrors.js │ │ │ │ ├── debug.js │ │ │ │ ├── extendedApi.js │ │ │ │ ├── individualCommands.js │ │ │ │ ├── multi.js │ │ │ │ └── utils.js │ │ │ └── package.json │ │ ├── submono │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── package.json │ │ │ └── submono.js │ │ ├── ultron │ │ │ ├── .npmignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── test.js │ │ └── ws │ │ │ ├── .npmignore │ │ │ ├── .travis.yml │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── SECURITY.md │ │ │ ├── index.js │ │ │ ├── lib │ │ │ ├── BufferPool.js │ │ │ ├── BufferUtil.fallback.js │ │ │ ├── BufferUtil.js │ │ │ ├── ErrorCodes.js │ │ │ ├── Extensions.js │ │ │ ├── PerMessageDeflate.js │ │ │ ├── Receiver.hixie.js │ │ │ ├── Receiver.js │ │ │ ├── Sender.hixie.js │ │ │ ├── Sender.js │ │ │ ├── Validation.fallback.js │ │ │ ├── Validation.js │ │ │ ├── WebSocket.js │ │ │ └── WebSocketServer.js │ │ │ └── package.json │ ├── package.json │ └── server.js ├── v1 │ ├── assets │ │ ├── css │ │ │ └── styles.css │ │ └── js │ │ │ └── main.js │ ├── index.html │ ├── node_modules │ │ └── submono │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── package.json │ │ │ └── submono.js │ └── package.json ├── v2 │ ├── assets │ │ ├── css │ │ │ └── styles.css │ │ └── js │ │ │ └── main.js │ ├── index.html │ ├── node_modules │ │ ├── options │ │ │ ├── .npmignore │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── lib │ │ │ │ └── options.js │ │ │ └── package.json │ │ ├── submono │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── package.json │ │ │ └── submono.js │ │ ├── ultron │ │ │ ├── .npmignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── test.js │ │ └── ws │ │ │ ├── .npmignore │ │ │ ├── .travis.yml │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── SECURITY.md │ │ │ ├── index.js │ │ │ ├── lib │ │ │ ├── BufferPool.js │ │ │ ├── BufferUtil.fallback.js │ │ │ ├── BufferUtil.js │ │ │ ├── ErrorCodes.js │ │ │ ├── Extensions.js │ │ │ ├── PerMessageDeflate.js │ │ │ ├── Receiver.hixie.js │ │ │ ├── Receiver.js │ │ │ ├── Sender.hixie.js │ │ │ ├── Sender.js │ │ │ ├── Validation.fallback.js │ │ │ ├── Validation.js │ │ │ ├── WebSocket.js │ │ │ └── WebSocketServer.js │ │ │ └── package.json │ ├── package.json │ └── server.js ├── v3 │ ├── assets │ │ ├── css │ │ │ └── styles.css │ │ └── js │ │ │ └── main.js │ ├── index.html │ ├── node_modules │ │ ├── double-ended-queue │ │ │ ├── .npmignore │ │ │ ├── Gruntfile.js │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── js │ │ │ │ └── deque.js │ │ │ └── package.json │ │ ├── options │ │ │ ├── .npmignore │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── lib │ │ │ │ └── options.js │ │ │ └── package.json │ │ ├── redis-commands │ │ │ ├── .npmignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── changelog.md │ │ │ ├── commands.json │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ ├── test │ │ │ │ └── index.js │ │ │ └── tools │ │ │ │ └── build.js │ │ ├── redis-parser │ │ │ ├── .codeclimate.yml │ │ │ ├── .npmignore │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── changelog.md │ │ │ ├── index.js │ │ │ ├── lib │ │ │ │ ├── hiredis.js │ │ │ │ ├── parser.js │ │ │ │ └── replyError.js │ │ │ └── package.json │ │ ├── redis │ │ │ ├── .eslintignore │ │ │ ├── .eslintrc │ │ │ ├── .github │ │ │ │ ├── ISSUE_TEMPLATE.md │ │ │ │ └── PULL_REQUEST_TEMPLATE.md │ │ │ ├── .npmignore │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── changelog.md │ │ │ ├── index.js │ │ │ ├── lib │ │ │ │ ├── command.js │ │ │ │ ├── commands.js │ │ │ │ ├── createClient.js │ │ │ │ ├── customErrors.js │ │ │ │ ├── debug.js │ │ │ │ ├── extendedApi.js │ │ │ │ ├── individualCommands.js │ │ │ │ ├── multi.js │ │ │ │ └── utils.js │ │ │ └── package.json │ │ ├── submono │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── package.json │ │ │ └── submono.js │ │ ├── ultron │ │ │ ├── .npmignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── test.js │ │ └── ws │ │ │ ├── .npmignore │ │ │ ├── .travis.yml │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── SECURITY.md │ │ │ ├── index.js │ │ │ ├── lib │ │ │ ├── BufferPool.js │ │ │ ├── BufferUtil.fallback.js │ │ │ ├── BufferUtil.js │ │ │ ├── ErrorCodes.js │ │ │ ├── Extensions.js │ │ │ ├── PerMessageDeflate.js │ │ │ ├── Receiver.hixie.js │ │ │ ├── Receiver.js │ │ │ ├── Sender.hixie.js │ │ │ ├── Sender.js │ │ │ ├── Validation.fallback.js │ │ │ ├── Validation.js │ │ │ ├── WebSocket.js │ │ │ └── WebSocketServer.js │ │ │ └── package.json │ ├── package.json │ └── server.js ├── v4 │ ├── assets │ │ ├── css │ │ │ └── styles.css │ │ └── js │ │ │ └── main.js │ ├── haproxy.cfg │ ├── index.html │ ├── node_modules │ │ ├── double-ended-queue │ │ │ ├── .npmignore │ │ │ ├── Gruntfile.js │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── js │ │ │ │ └── deque.js │ │ │ └── package.json │ │ ├── options │ │ │ ├── .npmignore │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── lib │ │ │ │ └── options.js │ │ │ └── package.json │ │ ├── redis-commands │ │ │ ├── .npmignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── changelog.md │ │ │ ├── commands.json │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ ├── test │ │ │ │ └── index.js │ │ │ └── tools │ │ │ │ └── build.js │ │ ├── redis-parser │ │ │ ├── .codeclimate.yml │ │ │ ├── .npmignore │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── changelog.md │ │ │ ├── index.js │ │ │ ├── lib │ │ │ │ ├── hiredis.js │ │ │ │ ├── parser.js │ │ │ │ └── replyError.js │ │ │ └── package.json │ │ ├── redis │ │ │ ├── .eslintignore │ │ │ ├── .eslintrc │ │ │ ├── .github │ │ │ │ ├── ISSUE_TEMPLATE.md │ │ │ │ └── PULL_REQUEST_TEMPLATE.md │ │ │ ├── .npmignore │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── changelog.md │ │ │ ├── index.js │ │ │ ├── lib │ │ │ │ ├── command.js │ │ │ │ ├── commands.js │ │ │ │ ├── createClient.js │ │ │ │ ├── customErrors.js │ │ │ │ ├── debug.js │ │ │ │ ├── extendedApi.js │ │ │ │ ├── individualCommands.js │ │ │ │ ├── multi.js │ │ │ │ └── utils.js │ │ │ └── package.json │ │ ├── submono │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── package.json │ │ │ └── submono.js │ │ ├── ultron │ │ │ ├── .npmignore │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── test.js │ │ └── ws │ │ │ ├── .npmignore │ │ │ ├── .travis.yml │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── SECURITY.md │ │ │ ├── index.js │ │ │ ├── lib │ │ │ ├── BufferPool.js │ │ │ ├── BufferUtil.fallback.js │ │ │ ├── BufferUtil.js │ │ │ ├── ErrorCodes.js │ │ │ ├── Extensions.js │ │ │ ├── PerMessageDeflate.js │ │ │ ├── Receiver.hixie.js │ │ │ ├── Receiver.js │ │ │ ├── Sender.hixie.js │ │ │ ├── Sender.js │ │ │ ├── Validation.fallback.js │ │ │ ├── Validation.js │ │ │ ├── WebSocket.js │ │ │ └── WebSocketServer.js │ │ │ └── package.json │ ├── package.json │ └── server.js └── v5 │ ├── assets │ ├── css │ │ └── styles.css │ └── js │ │ └── main.js │ ├── haproxy.cfg │ ├── index.html │ ├── package.json │ └── server.js └── talk ├── css ├── print │ ├── paper.css │ └── pdf.css ├── reveal.css ├── reveal.scss └── theme │ ├── README.md │ ├── beige.css │ ├── black.css │ ├── blood.css │ ├── league.css │ ├── moon.css │ ├── night.css │ ├── serif.css │ ├── simple.css │ ├── sky.css │ ├── solarized.css │ ├── source │ ├── beige.scss │ ├── black.scss │ ├── blood.scss │ ├── league.scss │ ├── moon.scss │ ├── night.scss │ ├── serif.scss │ ├── simple.scss │ ├── sky.scss │ ├── solarized.scss │ └── white.scss │ ├── template │ ├── mixins.scss │ ├── settings.scss │ └── theme.scss │ └── white.css ├── images ├── github.svg ├── goldfire.svg ├── howler.svg ├── james.png ├── stack01.png ├── stack02.png └── twitter.svg ├── index.html ├── js └── reveal.js ├── lib ├── css │ └── zenburn.css ├── font │ ├── league-gothic │ │ ├── LICENSE │ │ ├── league-gothic.css │ │ ├── league-gothic.eot │ │ ├── league-gothic.ttf │ │ └── league-gothic.woff │ └── source-sans-pro │ │ ├── LICENSE │ │ ├── source-sans-pro-italic.eot │ │ ├── source-sans-pro-italic.ttf │ │ ├── source-sans-pro-italic.woff │ │ ├── source-sans-pro-regular.eot │ │ ├── source-sans-pro-regular.ttf │ │ ├── source-sans-pro-regular.woff │ │ ├── source-sans-pro-semibold.eot │ │ ├── source-sans-pro-semibold.ttf │ │ ├── source-sans-pro-semibold.woff │ │ ├── source-sans-pro-semibolditalic.eot │ │ ├── source-sans-pro-semibolditalic.ttf │ │ ├── source-sans-pro-semibolditalic.woff │ │ └── source-sans-pro.css └── js │ ├── classList.js │ ├── head.min.js │ └── html5shiv.js ├── package.json └── plugin ├── highlight └── highlight.js ├── markdown ├── example.html ├── example.md ├── markdown.js └── marked.js ├── math └── math.js ├── multiplex ├── client.js ├── index.js ├── master.js └── package.json ├── notes-server ├── client.js ├── index.js └── notes.html ├── notes ├── notes.html └── notes.js ├── print-pdf └── print-pdf.js ├── search └── search.js └── zoom-js └── zoom.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Horizontally Scaling Node.js and Websockets 2 | Underneath every breakout website or app is a horizontally scaling back-end, but how do we get from a single process Node.js server to a highly-available, auto-scaling system? In this talk, we’ll take a high level look at a full production stack before getting our hands dirty with the secret sauce: Node.js, WebSockets and Redis. Through a live coding demo, you’ll learn how to take a single-server app and scale it infinitely. Walk away with a better conceptual understanding of high-scale web systems and practical tools to start implementing these techniques in your own projects today. 3 | 4 | * **View Slides:** [Slideshare](https://www.slideshare.net/secret/HiaKWCXBrbApCE) 5 | * **Live Demo:** [scale.goldfirestudios.com](http://scale.goldfirestudios.com) 6 | -------------------------------------------------------------------------------- /haproxy.cfg: -------------------------------------------------------------------------------- 1 | frontend all 2 | bind 0.0.0.0:8000 3 | default_backend sockets 4 | 5 | backend sockets 6 | balance leastconn 7 | server srv1 127.0.0.1:2000 check 8 | server srv2 127.0.0.1:2001 check -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Horizontally Scaling Node.js & Websockets Demo 7 | 8 | 9 | 10 | 11 |
12 |
Click or touch window to play.
13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Horizontally-Scaling-Node.js-Websockets-Talk", 3 | "description": "Talk about horizontally scaling node.js and WebSockets given at Connect.Tech 2016 and Thunder Plains 2016.", 4 | "author": "James Simpson (http://goldfirestudios.com)", 5 | "repository": { 6 | "type": "git", 7 | "url": "git://github.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk.git" 8 | }, 9 | "dependencies": { 10 | "submono": "*", 11 | "ws": "*", 12 | "redis": "*", 13 | "primus": "*" 14 | } 15 | } -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | var port = parseInt(process.argv[2], 10); 2 | var Primus = require('primus'); 3 | var primus = new Primus.createServer({port: port, transformer: 'websockets'}); 4 | var redis = require('redis'); 5 | var pub = redis.createClient(); 6 | var sub = redis.createClient(); 7 | var color = 'blue'; 8 | 9 | switch (port) { 10 | case 2001: 11 | color = 'red'; 12 | break; 13 | 14 | case 2002: 15 | color = 'green'; 16 | break; 17 | 18 | case 2003: 19 | color = 'purple'; 20 | break; 21 | } 22 | 23 | sub.subscribe('global'); 24 | sub.on('message', function(channel, msg) { 25 | if (channel === 'global') { 26 | primus.write(JSON.parse(msg)); 27 | } 28 | }); 29 | 30 | primus.on('connection', function(ws) { 31 | console.log('CONNECTED', port); 32 | ws.on('data', function(msg) { 33 | msg.color = color; 34 | pub.publish('global', JSON.stringify(msg)); 35 | }); 36 | }); -------------------------------------------------------------------------------- /src/prod/haproxy.cfg: -------------------------------------------------------------------------------- 1 | frontend all 2 | bind 0.0.0.0:80 3 | default_backend sockets 4 | 5 | backend sockets 6 | balance leastconn 7 | server srv1 127.0.0.1:2000 check 8 | server srv2 127.0.0.1:2001 check 9 | server srv3 127.0.0.1:2002 check 10 | server srv4 127.0.0.1:2003 check -------------------------------------------------------------------------------- /src/prod/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Horizontally Scaling Node.js & Websockets Demo 7 | 8 | 9 | 10 | 11 |
12 |
Click or touch window to play.
13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/prod/node_modules/double-ended-queue/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules/* 2 | todo.txt 3 | npm-debug.log 4 | test/* 5 | benchmark/* 6 | browser/* 7 | src/* 8 | async 9 | sync 10 | mixed 11 | bench.json 12 | js/browser 13 | js/browser/* 14 | js/debug 15 | js/debug/* 16 | reader.js 17 | read.txt 18 | bench 19 | .editorconfig 20 | .jshintrc 21 | ast_passes.js 22 | mocharun.js 23 | throwaway.js 24 | throwaway.html 25 | deque.sublime-workspace 26 | deque.sublime-project 27 | changelog.js 28 | .travis.yml 29 | sauce_connect.log 30 | nodex64.exe 31 | bump.js 32 | -------------------------------------------------------------------------------- /src/prod/node_modules/double-ended-queue/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Petka Antonov 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions:

9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /src/prod/node_modules/options/.npmignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | node_modules 3 | .*.swp 4 | .lock-* 5 | build/ 6 | 7 | test 8 | -------------------------------------------------------------------------------- /src/prod/node_modules/options/Makefile: -------------------------------------------------------------------------------- 1 | ALL_TESTS = $(shell find test/ -name '*.test.js') 2 | 3 | run-tests: 4 | @./node_modules/.bin/mocha \ 5 | -t 2000 \ 6 | $(TESTFLAGS) \ 7 | $(TESTS) 8 | 9 | test: 10 | @$(MAKE) NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests 11 | 12 | .PHONY: test 13 | -------------------------------------------------------------------------------- /src/prod/node_modules/options/README.md: -------------------------------------------------------------------------------- 1 | # options.js # 2 | 3 | A very light-weight in-code option parsers for node.js. 4 | 5 | ## Usage ## 6 | 7 | ``` js 8 | var Options = require("options"); 9 | 10 | // Create an Options object 11 | function foo(options) { 12 | var default_options = { 13 | foo : "bar" 14 | }; 15 | 16 | // Create an option object with default value 17 | var opts = new Options(default_options); 18 | 19 | // Merge options 20 | opts = opts.merge(options); 21 | 22 | // Reset to default value 23 | opts.reset(); 24 | 25 | // Copy selected attributes out 26 | var seled_att = opts.copy("foo"); 27 | 28 | // Read json options from a file. 29 | opts.read("options.file"); // Sync 30 | opts.read("options.file", function(err){ // Async 31 | if(err){ // If error occurs 32 | console.log("File error."); 33 | }else{ 34 | // No error 35 | } 36 | }); 37 | 38 | // Attributes defined or not 39 | opts.isDefinedAndNonNull("foobar"); 40 | opts.isDefined("foobar"); 41 | } 42 | 43 | ``` 44 | 45 | 46 | ## License ## 47 | 48 | (The MIT License) 49 | 50 | Copyright (c) 2012 Einar Otto Stangvik <einaros@gmail.com> 51 | 52 | Permission is hereby granted, free of charge, to any person obtaining 53 | a copy of this software and associated documentation files (the 54 | 'Software'), to deal in the Software without restriction, including 55 | without limitation the rights to use, copy, modify, merge, publish, 56 | distribute, sublicense, and/or sell copies of the Software, and to 57 | permit persons to whom the Software is furnished to do so, subject to 58 | the following conditions: 59 | 60 | The above copyright notice and this permission notice shall be 61 | included in all copies or substantial portions of the Software. 62 | 63 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 64 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 65 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 66 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 67 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 68 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 69 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 70 | -------------------------------------------------------------------------------- /src/prod/node_modules/redis-commands/.npmignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | *.rdb 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # Compiled binary addons (http://nodejs.org/api/addons.html) 21 | build/Release 22 | 23 | # Dependency directory 24 | # Commenting this out is preferred by some people, see 25 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- 26 | node_modules 27 | 28 | # Users Environment Variables 29 | .lock-wscript 30 | -------------------------------------------------------------------------------- /src/prod/node_modules/redis-commands/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | sudo: false 3 | node_js: 4 | - "0.10" 5 | - "0.12" 6 | - "4" 7 | - "5" 8 | after_success: 9 | - CODECLIMATE_REPO_TOKEN=b57723fafcf0516f275d6b380cd506fd082ea88d86507eb82c8abd489b9b9a09 node ./node_modules/.bin/codeclimate-test-reporter < coverage/lcov.info 10 | -------------------------------------------------------------------------------- /src/prod/node_modules/redis-commands/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 NodeRedis 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/prod/node_modules/redis-commands/README.md: -------------------------------------------------------------------------------- 1 | # Redis Commands 2 | 3 | [![Build Status](https://travis-ci.org/NodeRedis/redis-commands.png?branch=master)](https://travis-ci.org/NodeRedis/redis-commands) 4 | [![Code Climate](https://codeclimate.com/github/NodeRedis/redis-commands/badges/gpa.svg)](https://codeclimate.com/github/NodeRedis/redis-commands) 5 | [![Test Coverage](https://codeclimate.com/github/NodeRedis/redis-commands/badges/coverage.svg)](https://codeclimate.com/github/NodeRedis/redis-commands/coverage) 6 | 7 | This module exports all the commands that Redis supports. 8 | 9 | ## Install 10 | 11 | ```shell 12 | $ npm install redis-commands 13 | ``` 14 | 15 | ## Usage 16 | 17 | ```javascript 18 | var commands = require('redis-commands'); 19 | ``` 20 | 21 | `.list` is an array contains all the lowercased commands: 22 | 23 | ```javascript 24 | commands.list.forEach(function (command) { 25 | console.log(command); 26 | }); 27 | ``` 28 | 29 | `.exists()` is used to check if the command exists: 30 | 31 | ```javascript 32 | commands.exists('set') // true 33 | commands.exists('other-command') // false 34 | ``` 35 | 36 | `.hasFlag()` is used to check if the command has the flag: 37 | 38 | ```javascript 39 | commands.hasFlag('set', 'readonly') // false 40 | ``` 41 | 42 | `.getKeyIndexes()` is used to get the indexes of keys in the command arguments: 43 | 44 | ```javascript 45 | commands.getKeyIndexes('set', ['key', 'value']) // [0] 46 | commands.getKeyIndexes('mget', ['key1', 'key2']) // [0, 1] 47 | ``` 48 | 49 | ## Acknowledgment 50 | 51 | Thank [@Yuan Chuan](https://github.com/yuanchuan) for the package name. The original redis-commands is renamed to [@yuanchuan/redis-commands](https://www.npmjs.com/package/@yuanchuan/redis-commands). 52 | -------------------------------------------------------------------------------- /src/prod/node_modules/redis-commands/changelog.md: -------------------------------------------------------------------------------- 1 | ## v.1.2.0 - 21 Apr, 2016 2 | 3 | Features 4 | 5 | - Added support for `MIGRATE [...] KEYS key1, key2` (Redis >= v.3.0.6) 6 | - Added build sanity check for unhandled commands with moveable keys 7 | - Rebuild the commands with the newest unstable release 8 | - Improved performance of .getKeyIndexes() 9 | 10 | Bugfix 11 | 12 | - Fixed command command returning the wrong arity due to a Redis bug 13 | - Fixed brpop command returning the wrong keystop due to a Redis bug 14 | 15 | ## v.1.1.0 - 09 Feb, 2016 16 | 17 | Features 18 | 19 | - Added .exists() to check for command existence 20 | - Improved performance of .hasFlag() 21 | -------------------------------------------------------------------------------- /src/prod/node_modules/redis-commands/tools/build.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var path = require('path'); 3 | var stringify = require('json-stable-stringify'); 4 | var commandPath = path.join(__dirname, '..', 'commands.json'); 5 | var redisCommands = require('../'); 6 | 7 | var Redis = require('ioredis'); 8 | var redis = new Redis(process.env.REDIS_URI); 9 | 10 | redis.command().then(function (res) { 11 | redis.disconnect(); 12 | 13 | // Find all special handled cases 14 | var movableKeys = String(redisCommands.getKeyIndexes).match(/case '[a-z-]+':/g).map(function (entry) { 15 | return entry.replace(/^case \'|\':$/g, ''); 16 | }); 17 | 18 | var commands = res.reduce(function (prev, current) { 19 | var currentCommandPos = movableKeys.indexOf(current[0]); 20 | if (currentCommandPos !== -1 && current[2].indexOf('movablekeys') !== -1) { 21 | movableKeys.splice(currentCommandPos, 1); 22 | } 23 | // https://github.com/antirez/redis/issues/2598 24 | if (current[0] === 'brpop' && current[4] === 1) { 25 | current[4] = -2; 26 | } 27 | prev[current[0]] = { 28 | arity: current[1] || 1, // https://github.com/antirez/redis/pull/2986 29 | flags: current[2], 30 | keyStart: current[3], 31 | keyStop: current[4], 32 | step: current[5] 33 | }; 34 | return prev; 35 | }, {}); 36 | 37 | // Future proof. Redis might implement this at some point 38 | // https://github.com/antirez/redis/pull/2982 39 | if (!commands.quit) { 40 | commands.quit = { 41 | arity: 1, 42 | flags: [ 43 | 'loading', 44 | 'stale', 45 | 'readonly' 46 | ], 47 | keyStart: 0, 48 | keyStop: 0, 49 | step: 0 50 | } 51 | } 52 | 53 | if (movableKeys.length !== 0) { 54 | throw new Error('Not all commands (\'' + movableKeys.join('\', \'') + '\') with the "movablekeys" flag are handled in the code'); 55 | } 56 | 57 | // Use json-stable-stringify instead fo JSON.stringify 58 | // for easier diffing 59 | var content = stringify(commands, { space: ' ' }); 60 | 61 | fs.writeFile(commandPath, content); 62 | }); 63 | -------------------------------------------------------------------------------- /src/prod/node_modules/redis-parser/.codeclimate.yml: -------------------------------------------------------------------------------- 1 | languages: 2 | JavaScript: true 3 | exclude_paths: 4 | - "benchmark/index.js" 5 | - "benchmark/old/javascript.js" 6 | - "test/parsers.spec.js" 7 | -------------------------------------------------------------------------------- /src/prod/node_modules/redis-parser/.npmignore: -------------------------------------------------------------------------------- 1 | # IntelliJ project files 2 | .idea 3 | *.iml 4 | out 5 | gen 6 | 7 | # Unrelevant files and folders 8 | benchmark 9 | coverage 10 | test 11 | .travis.yml 12 | .gitignore 13 | -------------------------------------------------------------------------------- /src/prod/node_modules/redis-parser/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 NodeRedis 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/prod/node_modules/redis-parser/changelog.md: -------------------------------------------------------------------------------- 1 | ## v.2.0.4 - 21 Jul, 2016 2 | 3 | Bugfixes 4 | 5 | - Fixed multi byte characters getting corrupted 6 | 7 | ## v.2.0.3 - 17 Jun, 2016 8 | 9 | Bugfixes 10 | 11 | - Fixed parser not working with huge buffers (e.g. 300 MB) 12 | 13 | ## v.2.0.2 - 08 Jun, 2016 14 | 15 | Bugfixes 16 | 17 | - Fixed parser with returnBuffers option returning corrupted data 18 | 19 | ## v.2.0.1 - 04 Jun, 2016 20 | 21 | Bugfixes 22 | 23 | - Fixed multiple parsers working concurrently resulting in faulty data in some cases 24 | 25 | ## v.2.0.0 - 29 May, 2016 26 | 27 | The javascript parser got completly rewritten by [Michael Diarmid](https://github.com/Salakar) and [Ruben Bridgewater](https://github.com/BridgeAR) and is now a lot faster than the hiredis parser. 28 | Therefore the hiredis parser was deprecated and should only be used for testing purposes and benchmarking comparison. 29 | 30 | All Errors returned by the parser are from now on of class ReplyError 31 | 32 | Features 33 | 34 | - Improved performance by up to 15x as fast as before 35 | - Improved options validation 36 | - Added ReplyError Class 37 | - Added parser benchmark 38 | - Switched default parser from hiredis to JS, no matter if hiredis is installed or not 39 | 40 | Removed 41 | 42 | - Deprecated hiredis support 43 | 44 | ## v.1.3.0 - 27 Mar, 2016 45 | 46 | Features 47 | 48 | - Added `auto` as parser name option to check what parser is available 49 | - Non existing requested parsers falls back into auto mode instead of always choosing the JS parser 50 | 51 | ## v.1.2.0 - 27 Mar, 2016 52 | 53 | Features 54 | 55 | - Added `stringNumbers` option to make sure all numbers are returned as string instead of a js number for precision 56 | - The parser is from now on going to print warnings if a parser is explicitly requested that does not exist and gracefully chooses the JS parser 57 | 58 | ## v.1.1.0 - 26 Jan, 2016 59 | 60 | Features 61 | 62 | - The parser is from now on going to reset itself on protocol errors 63 | -------------------------------------------------------------------------------- /src/prod/node_modules/redis-parser/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | module.exports = require('./lib/parser') 4 | module.exports.ReplyError = require('./lib/replyError') 5 | -------------------------------------------------------------------------------- /src/prod/node_modules/redis-parser/lib/hiredis.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | var hiredis = require('hiredis') 4 | var ReplyError = require('../lib/replyError') 5 | 6 | /** 7 | * Parse data 8 | * @param parser 9 | * @returns {*} 10 | */ 11 | function parseData (parser) { 12 | try { 13 | return parser.reader.get() 14 | } catch (err) { 15 | // Protocol errors land here 16 | // Reset the parser. Otherwise new commands can't be processed properly 17 | parser.reader = new hiredis.Reader(parser.options) 18 | parser.returnFatalError(new ReplyError(err.message)) 19 | } 20 | } 21 | 22 | /** 23 | * Hiredis Parser 24 | * @param options 25 | * @constructor 26 | */ 27 | function HiredisReplyParser (options) { 28 | this.returnError = options.returnError 29 | this.returnFatalError = options.returnFatalError || options.returnError 30 | this.returnReply = options.returnReply 31 | this.name = 'hiredis' 32 | this.options = { 33 | return_buffers: !!options.returnBuffers 34 | } 35 | this.reader = new hiredis.Reader(this.options) 36 | } 37 | 38 | HiredisReplyParser.prototype.execute = function (data) { 39 | this.reader.feed(data) 40 | var reply = parseData(this) 41 | 42 | while (reply !== undefined) { 43 | if (reply && reply.name === 'Error') { 44 | this.returnError(new ReplyError(reply.message)) 45 | } else { 46 | this.returnReply(reply) 47 | } 48 | reply = parseData(this) 49 | } 50 | } 51 | 52 | module.exports = HiredisReplyParser 53 | -------------------------------------------------------------------------------- /src/prod/node_modules/redis-parser/lib/replyError.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | var util = require('util') 4 | 5 | function ReplyError (message) { 6 | var limit = Error.stackTraceLimit 7 | Error.stackTraceLimit = 2 8 | Error.captureStackTrace(this, this.constructor) 9 | Error.stackTraceLimit = limit 10 | Object.defineProperty(this, 'message', { 11 | value: message || '', 12 | writable: true 13 | }) 14 | } 15 | 16 | util.inherits(ReplyError, Error) 17 | 18 | Object.defineProperty(ReplyError.prototype, 'name', { 19 | value: 'ReplyError', 20 | writable: true 21 | }) 22 | 23 | module.exports = ReplyError 24 | -------------------------------------------------------------------------------- /src/prod/node_modules/redis/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules/** 2 | coverage/** 3 | **.md 4 | **.log 5 | -------------------------------------------------------------------------------- /src/prod/node_modules/redis/.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | _Thanks for wanting to report an issue you've found in node_redis. Please delete 2 | this text and fill in the template below. Please note that the issue tracker is only 3 | for bug reports or feature requests. If you have a question, please ask that on [gitter]. 4 | If unsure about something, just do as best as you're able._ 5 | 6 | _Note that it will be much easier to fix the issue if a test case that reproduces 7 | the problem is provided. It is of course not always possible to reduce your code 8 | to a small test case, but it's highly appreciated to have as much data as possible. 9 | Thank you!_ 10 | 11 | * **Version**: What node_redis and what redis version is the issue happening on? 12 | * **Platform**: What platform / version? (For example Node.js 0.10 or Node.js 5.7.0 on Windows 7 / Ubuntu 15.10 / Azure) 13 | * **Description**: Description of your issue, stack traces from errors and code that reproduces the issue 14 | 15 | [gitter]: https://gitter.im/NodeRedis/node_redis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge -------------------------------------------------------------------------------- /src/prod/node_modules/redis/.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Pull Request check-list 2 | 3 | _Please make sure to review and check all of these items:_ 4 | 5 | - [ ] Does `npm test` pass with this change (including linting)? 6 | - [ ] Is the new or changed code fully tested? 7 | - [ ] Is a documentation update included (if this change modifies existing APIs, or introduces new ones)? 8 | 9 | _NOTE: these things are not required to open a PR and can be done 10 | afterwards / while the PR is open._ 11 | 12 | ### Description of change 13 | 14 | _Please provide a description of the change here._ -------------------------------------------------------------------------------- /src/prod/node_modules/redis/.npmignore: -------------------------------------------------------------------------------- 1 | examples/ 2 | benchmarks/ 3 | test/ 4 | .nyc_output/ 5 | coverage/ 6 | .tern-port 7 | *.log 8 | *.rdb 9 | *.out 10 | *.yml 11 | -------------------------------------------------------------------------------- /src/prod/node_modules/redis/LICENSE: -------------------------------------------------------------------------------- 1 | LICENSE - "MIT License" 2 | 3 | Copyright (c) 2016 by NodeRedis 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the "Software"), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /src/prod/node_modules/redis/lib/command.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var betterStackTraces = /development/i.test(process.env.NODE_ENV) || /\bredis\b/i.test(process.env.NODE_DEBUG); 4 | 5 | function Command (command, args, callback, call_on_write) { 6 | this.command = command; 7 | this.args = args; 8 | this.buffer_args = false; 9 | this.callback = callback; 10 | this.call_on_write = call_on_write; 11 | if (betterStackTraces) { 12 | this.error = new Error(); 13 | } 14 | } 15 | 16 | module.exports = Command; 17 | -------------------------------------------------------------------------------- /src/prod/node_modules/redis/lib/customErrors.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var util = require('util'); 4 | 5 | function AbortError (obj) { 6 | Error.captureStackTrace(this, this.constructor); 7 | Object.defineProperty(this, 'message', { 8 | value: obj.message || '', 9 | configurable: true, 10 | writable: true 11 | }); 12 | for (var keys = Object.keys(obj), key = keys.pop(); key; key = keys.pop()) { 13 | this[key] = obj[key]; 14 | } 15 | } 16 | 17 | function AggregateError (obj) { 18 | Error.captureStackTrace(this, this.constructor); 19 | Object.defineProperty(this, 'message', { 20 | value: obj.message || '', 21 | configurable: true, 22 | writable: true 23 | }); 24 | for (var keys = Object.keys(obj), key = keys.pop(); key; key = keys.pop()) { 25 | this[key] = obj[key]; 26 | } 27 | } 28 | 29 | util.inherits(AbortError, Error); 30 | util.inherits(AggregateError, AbortError); 31 | 32 | Object.defineProperty(AbortError.prototype, 'name', { 33 | value: 'AbortError', 34 | // configurable: true, 35 | writable: true 36 | }); 37 | Object.defineProperty(AggregateError.prototype, 'name', { 38 | value: 'AggregateError', 39 | // configurable: true, 40 | writable: true 41 | }); 42 | 43 | module.exports = { 44 | AbortError: AbortError, 45 | AggregateError: AggregateError 46 | }; 47 | -------------------------------------------------------------------------------- /src/prod/node_modules/redis/lib/debug.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var index = require('../'); 4 | 5 | function debug () { 6 | if (index.debug_mode) { 7 | console.error.apply(null, arguments); 8 | } 9 | } 10 | 11 | module.exports = debug; 12 | -------------------------------------------------------------------------------- /src/prod/node_modules/submono/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Benji Kay 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/prod/node_modules/submono/README.md: -------------------------------------------------------------------------------- 1 | # submono 2 | A Web Audio subtractive, monophonic synthesizer. Looking for polyphony? Check out [subpoly](https://github.com/okaybenji/subpoly)! 3 | 4 | ### Create a synth. 5 | ``` 6 | var audioCtx = new AudioContext(); 7 | var synth = new Monosynth(audioCtx); 8 | ``` 9 | 10 | ### Play a note. 11 | `synth.start();` 12 | 13 | ### Stop playing. 14 | `synth.stop();` 15 | 16 | ### Use methods to access pitch and waveform... 17 | ``` 18 | synth.pitch(440); // in hertz 19 | console.log(synth.waveform()); // 'sawtooth' (or sine, triangle, square) 20 | ``` 21 | 22 | ### ...get or set any other properties directly. 23 | ``` 24 | synth.maxGain = 0.5; // out of 1 25 | synth.attack = 1.0; // in seconds 26 | ``` 27 | 28 | ### Configure any or all the properties on initialization. 29 | ``` 30 | var config = { 31 | waveform: 'sawtooth', // or sine, triangle, square 32 | pitch: 440, // in hertz 33 | maxGain: 0.5, // out of 1 34 | attack: 0.1, // in seconds 35 | decay: 0.0, // in seconds 36 | sustain: 1.0, // out of 1 37 | release: 0.8, // in seconds 38 | cutoff: { 39 | maxFrequency: 7500, // in hertz 40 | attack: 0.1, // in seconds 41 | decay: 2.5, // in seconds 42 | sustain: 0.2 // 0-5; maxFrequency multiplied by this 43 | } 44 | }; 45 | 46 | var synth = new Monosynth(audioCtx, config); 47 | ``` 48 | 49 | ### Demo 50 | [Tiles: a musical, multiplayer web toy](http://okaybenji.github.io/tiles-client/) 51 | -------------------------------------------------------------------------------- /src/prod/node_modules/ultron/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | .tern-port 4 | -------------------------------------------------------------------------------- /src/prod/node_modules/ultron/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - "0.12" 5 | - "0.10" 6 | - "0.8" 7 | - "iojs" 8 | before_install: 9 | - 'if [ "${TRAVIS_NODE_VERSION}" == "0.8" ]; then npm install -g npm@2.11.1; fi' 10 | script: 11 | - "npm run test-travis" 12 | after_script: 13 | - "npm install coveralls@2.11.x && cat coverage/lcov.info | coveralls" 14 | matrix: 15 | fast_finish: true 16 | notifications: 17 | irc: 18 | channels: 19 | - "irc.freenode.org#unshift" 20 | on_success: change 21 | on_failure: change 22 | -------------------------------------------------------------------------------- /src/prod/node_modules/ultron/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Unshift.io, Arnout Kazemier, the Contributors. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/prod/node_modules/ws/.npmignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | node_modules 3 | .*.swp 4 | .lock-* 5 | build 6 | 7 | bench 8 | doc 9 | examples 10 | test 11 | 12 | -------------------------------------------------------------------------------- /src/prod/node_modules/ws/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | sudo: false 3 | node_js: 4 | - "5" 5 | - "4" 6 | - "0.12" 7 | addons: 8 | apt: 9 | sources: 10 | - ubuntu-toolchain-r-test 11 | packages: 12 | - gcc-4.9 13 | - g++-4.9 14 | before_install: 15 | - export CC="gcc-4.9" CXX="g++-4.9" 16 | -------------------------------------------------------------------------------- /src/prod/node_modules/ws/Makefile: -------------------------------------------------------------------------------- 1 | ALL_TESTS = $(shell find test/ -name '*.test.js') 2 | ALL_INTEGRATION = $(shell find test/ -name '*.integration.js') 3 | 4 | run-tests: 5 | @./node_modules/.bin/mocha \ 6 | -t 5000 \ 7 | -s 2400 \ 8 | $(TESTFLAGS) \ 9 | $(TESTS) 10 | 11 | run-integrationtests: 12 | @./node_modules/.bin/mocha \ 13 | -t 5000 \ 14 | -s 6000 \ 15 | $(TESTFLAGS) \ 16 | $(TESTS) 17 | 18 | run-coverage: 19 | @./node_modules/.bin/istanbul cover --report html \ 20 | ./node_modules/.bin/_mocha -- \ 21 | -t 5000 \ 22 | -s 6000 \ 23 | $(TESTFLAGS) \ 24 | $(TESTS) 25 | 26 | test: 27 | @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests 28 | 29 | integrationtest: 30 | @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_INTEGRATION)" run-integrationtests 31 | 32 | coverage: 33 | @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_TESTS)" run-coverage 34 | 35 | benchmark: 36 | @node bench/sender.benchmark.js 37 | @node bench/parser.benchmark.js 38 | 39 | autobahn: 40 | @NODE_PATH=lib node test/autobahn.js 41 | 42 | autobahn-server: 43 | @NODE_PATH=lib node test/autobahn-server.js 44 | 45 | .PHONY: test coverage 46 | -------------------------------------------------------------------------------- /src/prod/node_modules/ws/SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Guidelines 2 | 3 | Please contact us directly at **security@3rd-Eden.com** for any bug that might 4 | impact the security of this project. Please prefix the subject of your email 5 | with `[security]` in lowercase and square brackets. Our email filters will 6 | automatically prevent these messages from being moved to our spam box. 7 | 8 | You will receive an acknowledgement of your report within **24 hours**. 9 | 10 | All emails that do not include security vulnerabilities will be removed and 11 | blocked instantly. 12 | 13 | ## Exceptions 14 | 15 | If you do not receive an acknowledgement within the said time frame please give 16 | us the benefit of the doubt as it's possible that we haven't seen it yet. In 17 | this case please send us a message **without details** using one of the 18 | following methods: 19 | 20 | - Contact the lead developers of this project on their personal e-mails. You 21 | can find the e-mails in the git logs, for example using the following command: 22 | `git --no-pager show -s --format='%an <%ae>' ` where `` is the 23 | SHA1 of their latest commit in the project. 24 | - Create a GitHub issue stating contact details and the severity of the issue. 25 | 26 | Once we have acknowledged receipt of your report and confirmed the bug 27 | ourselves we will work with you to fix the vulnerability and publicly acknowledge 28 | your responsible disclosure, if you wish. In addition to that we will report 29 | all vulnerabilities to the [Node Security Project](https://nodesecurity.io/). 30 | 31 | ## History 32 | 33 | 04 Jan 2016: [Buffer vulnerablity](https://github.com/websockets/ws/releases/tag/1.0.1) 34 | -------------------------------------------------------------------------------- /src/prod/node_modules/ws/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /*! 4 | * ws: a node.js websocket client 5 | * Copyright(c) 2011 Einar Otto Stangvik 6 | * MIT Licensed 7 | */ 8 | 9 | var WS = module.exports = require('./lib/WebSocket'); 10 | 11 | WS.Server = require('./lib/WebSocketServer'); 12 | WS.Sender = require('./lib/Sender'); 13 | WS.Receiver = require('./lib/Receiver'); 14 | 15 | /** 16 | * Create a new WebSocket server. 17 | * 18 | * @param {Object} options Server options 19 | * @param {Function} fn Optional connection listener. 20 | * @returns {WS.Server} 21 | * @api public 22 | */ 23 | WS.createServer = function createServer(options, fn) { 24 | var server = new WS.Server(options); 25 | 26 | if (typeof fn === 'function') { 27 | server.on('connection', fn); 28 | } 29 | 30 | return server; 31 | }; 32 | 33 | /** 34 | * Create a new WebSocket connection. 35 | * 36 | * @param {String} address The URL/address we need to connect to. 37 | * @param {Function} fn Open listener. 38 | * @returns {WS} 39 | * @api public 40 | */ 41 | WS.connect = WS.createConnection = function connect(address, fn) { 42 | var client = new WS(address); 43 | 44 | if (typeof fn === 'function') { 45 | client.on('open', fn); 46 | } 47 | 48 | return client; 49 | }; 50 | -------------------------------------------------------------------------------- /src/prod/node_modules/ws/lib/BufferPool.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | var util = require('util'); 8 | 9 | function BufferPool(initialSize, growStrategy, shrinkStrategy) { 10 | if (this instanceof BufferPool === false) { 11 | throw new TypeError("Classes can't be function-called"); 12 | } 13 | 14 | if (typeof initialSize === 'function') { 15 | shrinkStrategy = growStrategy; 16 | growStrategy = initialSize; 17 | initialSize = 0; 18 | } 19 | else if (typeof initialSize === 'undefined') { 20 | initialSize = 0; 21 | } 22 | this._growStrategy = (growStrategy || function(db, size) { 23 | return db.used + size; 24 | }).bind(null, this); 25 | this._shrinkStrategy = (shrinkStrategy || function(db) { 26 | return initialSize; 27 | }).bind(null, this); 28 | this._buffer = initialSize ? new Buffer(initialSize) : null; 29 | this._offset = 0; 30 | this._used = 0; 31 | this._changeFactor = 0; 32 | this.__defineGetter__('size', function(){ 33 | return this._buffer == null ? 0 : this._buffer.length; 34 | }); 35 | this.__defineGetter__('used', function(){ 36 | return this._used; 37 | }); 38 | } 39 | 40 | BufferPool.prototype.get = function(length) { 41 | if (this._buffer == null || this._offset + length > this._buffer.length) { 42 | var newBuf = new Buffer(this._growStrategy(length)); 43 | this._buffer = newBuf; 44 | this._offset = 0; 45 | } 46 | this._used += length; 47 | var buf = this._buffer.slice(this._offset, this._offset + length); 48 | this._offset += length; 49 | return buf; 50 | } 51 | 52 | BufferPool.prototype.reset = function(forceNewBuffer) { 53 | var len = this._shrinkStrategy(); 54 | if (len < this.size) this._changeFactor -= 1; 55 | if (forceNewBuffer || this._changeFactor < -2) { 56 | this._changeFactor = 0; 57 | this._buffer = len ? new Buffer(len) : null; 58 | } 59 | this._offset = 0; 60 | this._used = 0; 61 | } 62 | 63 | module.exports = BufferPool; 64 | -------------------------------------------------------------------------------- /src/prod/node_modules/ws/lib/BufferUtil.fallback.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | exports.BufferUtil = { 8 | merge: function(mergedBuffer, buffers) { 9 | var offset = 0; 10 | for (var i = 0, l = buffers.length; i < l; ++i) { 11 | var buf = buffers[i]; 12 | buf.copy(mergedBuffer, offset); 13 | offset += buf.length; 14 | } 15 | }, 16 | mask: function(source, mask, output, offset, length) { 17 | var maskNum = mask.readUInt32LE(0, true); 18 | var i = 0; 19 | for (; i < length - 3; i += 4) { 20 | var num = maskNum ^ source.readUInt32LE(i, true); 21 | if (num < 0) num = 4294967296 + num; 22 | output.writeUInt32LE(num, offset + i, true); 23 | } 24 | switch (length % 4) { 25 | case 3: output[offset + i + 2] = source[i + 2] ^ mask[2]; 26 | case 2: output[offset + i + 1] = source[i + 1] ^ mask[1]; 27 | case 1: output[offset + i] = source[i] ^ mask[0]; 28 | case 0:; 29 | } 30 | }, 31 | unmask: function(data, mask) { 32 | var maskNum = mask.readUInt32LE(0, true); 33 | var length = data.length; 34 | var i = 0; 35 | for (; i < length - 3; i += 4) { 36 | var num = maskNum ^ data.readUInt32LE(i, true); 37 | if (num < 0) num = 4294967296 + num; 38 | data.writeUInt32LE(num, i, true); 39 | } 40 | switch (length % 4) { 41 | case 3: data[i + 2] = data[i + 2] ^ mask[2]; 42 | case 2: data[i + 1] = data[i + 1] ^ mask[1]; 43 | case 1: data[i] = data[i] ^ mask[0]; 44 | case 0:; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/prod/node_modules/ws/lib/BufferUtil.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /*! 4 | * ws: a node.js websocket client 5 | * Copyright(c) 2011 Einar Otto Stangvik 6 | * MIT Licensed 7 | */ 8 | 9 | try { 10 | module.exports = require('bufferutil'); 11 | } catch (e) { 12 | module.exports = require('./BufferUtil.fallback'); 13 | } 14 | -------------------------------------------------------------------------------- /src/prod/node_modules/ws/lib/ErrorCodes.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | module.exports = { 8 | isValidErrorCode: function(code) { 9 | return (code >= 1000 && code <= 1011 && code != 1004 && code != 1005 && code != 1006) || 10 | (code >= 3000 && code <= 4999); 11 | }, 12 | 1000: 'normal', 13 | 1001: 'going away', 14 | 1002: 'protocol error', 15 | 1003: 'unsupported data', 16 | 1004: 'reserved', 17 | 1005: 'reserved for extensions', 18 | 1006: 'reserved for extensions', 19 | 1007: 'inconsistent or invalid data', 20 | 1008: 'policy violation', 21 | 1009: 'message too big', 22 | 1010: 'extension handshake missing', 23 | 1011: 'an unexpected condition prevented the request from being fulfilled', 24 | }; -------------------------------------------------------------------------------- /src/prod/node_modules/ws/lib/Extensions.js: -------------------------------------------------------------------------------- 1 | 2 | var util = require('util'); 3 | 4 | /** 5 | * Module exports. 6 | */ 7 | 8 | exports.parse = parse; 9 | exports.format = format; 10 | 11 | /** 12 | * Parse extensions header value 13 | */ 14 | 15 | function parse(value) { 16 | value = value || ''; 17 | 18 | var extensions = {}; 19 | 20 | value.split(',').forEach(function(v) { 21 | var params = v.split(';'); 22 | var token = params.shift().trim(); 23 | var paramsList = extensions[token] = extensions[token] || []; 24 | var parsedParams = {}; 25 | 26 | params.forEach(function(param) { 27 | var parts = param.trim().split('='); 28 | var key = parts[0]; 29 | var value = parts[1]; 30 | if (typeof value === 'undefined') { 31 | value = true; 32 | } else { 33 | // unquote value 34 | if (value[0] === '"') { 35 | value = value.slice(1); 36 | } 37 | if (value[value.length - 1] === '"') { 38 | value = value.slice(0, value.length - 1); 39 | } 40 | } 41 | (parsedParams[key] = parsedParams[key] || []).push(value); 42 | }); 43 | 44 | paramsList.push(parsedParams); 45 | }); 46 | 47 | return extensions; 48 | } 49 | 50 | /** 51 | * Format extensions header value 52 | */ 53 | 54 | function format(value) { 55 | return Object.keys(value).map(function(token) { 56 | var paramsList = value[token]; 57 | if (!util.isArray(paramsList)) { 58 | paramsList = [paramsList]; 59 | } 60 | return paramsList.map(function(params) { 61 | return [token].concat(Object.keys(params).map(function(k) { 62 | var p = params[k]; 63 | if (!util.isArray(p)) p = [p]; 64 | return p.map(function(v) { 65 | return v === true ? k : k + '=' + v; 66 | }).join('; '); 67 | })).join('; '); 68 | }).join(', '); 69 | }).join(', '); 70 | } 71 | -------------------------------------------------------------------------------- /src/prod/node_modules/ws/lib/Validation.fallback.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | exports.Validation = { 8 | isValidUTF8: function(buffer) { 9 | return true; 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /src/prod/node_modules/ws/lib/Validation.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /*! 4 | * ws: a node.js websocket client 5 | * Copyright(c) 2011 Einar Otto Stangvik 6 | * MIT Licensed 7 | */ 8 | 9 | try { 10 | module.exports = require('utf-8-validate'); 11 | } catch (e) { 12 | module.exports = require('./Validation.fallback'); 13 | } 14 | -------------------------------------------------------------------------------- /src/prod/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Horizontally-Scaling-Node.js-Websockets-Talk", 3 | "description": "Talk about horizontally scaling node.js and WebSockets given at Connect.Tech 2016 and Thunder Plains 2016.", 4 | "author": "James Simpson (http://goldfirestudios.com)", 5 | "repository": { 6 | "type": "git", 7 | "url": "git://github.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk.git" 8 | }, 9 | "dependencies": { 10 | "submono": "*", 11 | "ws": "*", 12 | "redis": "*", 13 | "primus": "*" 14 | } 15 | } -------------------------------------------------------------------------------- /src/prod/server.js: -------------------------------------------------------------------------------- 1 | var port = parseInt(process.argv[2], 10); 2 | var Primus = require('primus'); 3 | var primus = new Primus.createServer({port: port, transformer: 'websockets'}); 4 | var redis = require('redis'); 5 | var pub = redis.createClient(); 6 | var sub = redis.createClient(); 7 | var color = 'blue'; 8 | 9 | switch (port) { 10 | case 2001: 11 | color = 'red'; 12 | break; 13 | 14 | case 2002: 15 | color = 'green'; 16 | break; 17 | 18 | case 2003: 19 | color = 'purple'; 20 | break; 21 | } 22 | 23 | sub.subscribe('global'); 24 | sub.on('message', function(channel, msg) { 25 | if (channel === 'global') { 26 | primus.write(JSON.parse(msg)); 27 | } 28 | }); 29 | 30 | primus.on('connection', function(ws) { 31 | ws.on('data', function(msg) { 32 | msg.color = color; 33 | pub.publish('global', JSON.stringify(msg)); 34 | }); 35 | }); -------------------------------------------------------------------------------- /src/v1/assets/js/main.js: -------------------------------------------------------------------------------- 1 | // DOM Reference. 2 | var clickArea = document.querySelector('.click-area'); 3 | var introText = document.querySelector('.intro-text'); 4 | var audioContext = (typeof AudioContext !== 'undefined') ? new AudioContext() : new webkitAudioContext(); 5 | 6 | // Handle all clicks on the click area. 7 | clickArea.addEventListener('click', function onClick(event) { 8 | unlockMobile(); 9 | 10 | // Place color dot in this location. 11 | playAudioVisual(event.x, event.y, 'blue'); 12 | 13 | // Hide the intro text. 14 | introText.className = 'intro-text hide'; 15 | }, false); 16 | 17 | /** 18 | * Display the clicked/touched spot and play the associated tone. 19 | * @param {Number} x The x-coordinate clicked. 20 | * @param {Number} y The y-cooridnate clicked. 21 | * @param {String} color Color to rende the dot. 22 | */ 23 | function playAudioVisual(x, y, color) { 24 | // Adjust the location by the radius of the circle. 25 | x -= 25; 26 | y -= 25; 27 | 28 | // Setup the base DOM element. 29 | var div = document.createElement('div'); 30 | div.className = 'color-dot show ' + color; 31 | div.style.left = x + 'px'; 32 | div.style.top = y + 'px'; 33 | clickArea.appendChild(div); 34 | 35 | // Play the tone based on its location relative to the screen. 36 | var sounds = [280, 320, 350, 370, 400, 440, 470, 520, 540, 560, 590, 610, 640]; 37 | synth.pitch(sounds[Math.round((x / window.innerWidth) * sounds.length)]); 38 | synth.start(); 39 | 40 | // Fade out the circle. 41 | setTimeout(function() { 42 | synth.stop(); 43 | div.className = 'color-dot hide ' + color; 44 | }, 2000); 45 | 46 | // Remove the circle from the DOM. 47 | setTimeout(function() { 48 | clickArea.removeChild(div); 49 | }, 3000); 50 | } 51 | 52 | /** 53 | * Unlock Web Audio on mobile devices. 54 | */ 55 | function unlockMobile() { 56 | if (!unlocked) { 57 | var source = audioContext.createBufferSource(); 58 | source.buffer = audioContext.createBuffer(1, 1, 22050); 59 | source.connect(audioContext.destination); 60 | source.start(0); 61 | source.onended = function() { 62 | unlocked = true; 63 | source.disconnect(0); 64 | }; 65 | } 66 | } 67 | 68 | // Setup submono so that we can play a range of tones. 69 | var synth = new Monosynth(audioContext); 70 | var unlocked = false; -------------------------------------------------------------------------------- /src/v1/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Horizontally Scaling Node.js & Websockets Demo 7 | 8 | 9 | 10 | 11 |
12 |
Click or touch window to play.
13 |
14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/v1/node_modules/submono/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Benji Kay 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/v1/node_modules/submono/README.md: -------------------------------------------------------------------------------- 1 | # submono 2 | A Web Audio subtractive, monophonic synthesizer. Looking for polyphony? Check out [subpoly](https://github.com/okaybenji/subpoly)! 3 | 4 | ### Create a synth. 5 | ``` 6 | var audioCtx = new AudioContext(); 7 | var synth = new Monosynth(audioCtx); 8 | ``` 9 | 10 | ### Play a note. 11 | `synth.start();` 12 | 13 | ### Stop playing. 14 | `synth.stop();` 15 | 16 | ### Use methods to access pitch and waveform... 17 | ``` 18 | synth.pitch(440); // in hertz 19 | console.log(synth.waveform()); // 'sawtooth' (or sine, triangle, square) 20 | ``` 21 | 22 | ### ...get or set any other properties directly. 23 | ``` 24 | synth.maxGain = 0.5; // out of 1 25 | synth.attack = 1.0; // in seconds 26 | ``` 27 | 28 | ### Configure any or all the properties on initialization. 29 | ``` 30 | var config = { 31 | waveform: 'sawtooth', // or sine, triangle, square 32 | pitch: 440, // in hertz 33 | maxGain: 0.5, // out of 1 34 | attack: 0.1, // in seconds 35 | decay: 0.0, // in seconds 36 | sustain: 1.0, // out of 1 37 | release: 0.8, // in seconds 38 | cutoff: { 39 | maxFrequency: 7500, // in hertz 40 | attack: 0.1, // in seconds 41 | decay: 2.5, // in seconds 42 | sustain: 0.2 // 0-5; maxFrequency multiplied by this 43 | } 44 | }; 45 | 46 | var synth = new Monosynth(audioCtx, config); 47 | ``` 48 | 49 | ### Demo 50 | [Tiles: a musical, multiplayer web toy](http://okaybenji.github.io/tiles-client/) 51 | -------------------------------------------------------------------------------- /src/v1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Horizontally-Scaling-Node.js-Websockets-Talk", 3 | "description": "Talk about horizontally scaling node.js and WebSockets given at Connect.Tech 2016 and Thunder Plains 2016.", 4 | "author": "James Simpson (http://goldfirestudios.com)", 5 | "repository": { 6 | "type": "git", 7 | "url": "git://github.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk.git" 8 | }, 9 | "dependencies": { 10 | "submono": "*" 11 | } 12 | } -------------------------------------------------------------------------------- /src/v2/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Horizontally Scaling Node.js & Websockets Demo 7 | 8 | 9 | 10 | 11 |
12 |
Click or touch window to play.
13 |
14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/v2/node_modules/options/.npmignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | node_modules 3 | .*.swp 4 | .lock-* 5 | build/ 6 | 7 | test 8 | -------------------------------------------------------------------------------- /src/v2/node_modules/options/Makefile: -------------------------------------------------------------------------------- 1 | ALL_TESTS = $(shell find test/ -name '*.test.js') 2 | 3 | run-tests: 4 | @./node_modules/.bin/mocha \ 5 | -t 2000 \ 6 | $(TESTFLAGS) \ 7 | $(TESTS) 8 | 9 | test: 10 | @$(MAKE) NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests 11 | 12 | .PHONY: test 13 | -------------------------------------------------------------------------------- /src/v2/node_modules/options/README.md: -------------------------------------------------------------------------------- 1 | # options.js # 2 | 3 | A very light-weight in-code option parsers for node.js. 4 | 5 | ## Usage ## 6 | 7 | ``` js 8 | var Options = require("options"); 9 | 10 | // Create an Options object 11 | function foo(options) { 12 | var default_options = { 13 | foo : "bar" 14 | }; 15 | 16 | // Create an option object with default value 17 | var opts = new Options(default_options); 18 | 19 | // Merge options 20 | opts = opts.merge(options); 21 | 22 | // Reset to default value 23 | opts.reset(); 24 | 25 | // Copy selected attributes out 26 | var seled_att = opts.copy("foo"); 27 | 28 | // Read json options from a file. 29 | opts.read("options.file"); // Sync 30 | opts.read("options.file", function(err){ // Async 31 | if(err){ // If error occurs 32 | console.log("File error."); 33 | }else{ 34 | // No error 35 | } 36 | }); 37 | 38 | // Attributes defined or not 39 | opts.isDefinedAndNonNull("foobar"); 40 | opts.isDefined("foobar"); 41 | } 42 | 43 | ``` 44 | 45 | 46 | ## License ## 47 | 48 | (The MIT License) 49 | 50 | Copyright (c) 2012 Einar Otto Stangvik <einaros@gmail.com> 51 | 52 | Permission is hereby granted, free of charge, to any person obtaining 53 | a copy of this software and associated documentation files (the 54 | 'Software'), to deal in the Software without restriction, including 55 | without limitation the rights to use, copy, modify, merge, publish, 56 | distribute, sublicense, and/or sell copies of the Software, and to 57 | permit persons to whom the Software is furnished to do so, subject to 58 | the following conditions: 59 | 60 | The above copyright notice and this permission notice shall be 61 | included in all copies or substantial portions of the Software. 62 | 63 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 64 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 65 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 66 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 67 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 68 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 69 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 70 | -------------------------------------------------------------------------------- /src/v2/node_modules/submono/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Benji Kay 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/v2/node_modules/submono/README.md: -------------------------------------------------------------------------------- 1 | # submono 2 | A Web Audio subtractive, monophonic synthesizer. Looking for polyphony? Check out [subpoly](https://github.com/okaybenji/subpoly)! 3 | 4 | ### Create a synth. 5 | ``` 6 | var audioCtx = new AudioContext(); 7 | var synth = new Monosynth(audioCtx); 8 | ``` 9 | 10 | ### Play a note. 11 | `synth.start();` 12 | 13 | ### Stop playing. 14 | `synth.stop();` 15 | 16 | ### Use methods to access pitch and waveform... 17 | ``` 18 | synth.pitch(440); // in hertz 19 | console.log(synth.waveform()); // 'sawtooth' (or sine, triangle, square) 20 | ``` 21 | 22 | ### ...get or set any other properties directly. 23 | ``` 24 | synth.maxGain = 0.5; // out of 1 25 | synth.attack = 1.0; // in seconds 26 | ``` 27 | 28 | ### Configure any or all the properties on initialization. 29 | ``` 30 | var config = { 31 | waveform: 'sawtooth', // or sine, triangle, square 32 | pitch: 440, // in hertz 33 | maxGain: 0.5, // out of 1 34 | attack: 0.1, // in seconds 35 | decay: 0.0, // in seconds 36 | sustain: 1.0, // out of 1 37 | release: 0.8, // in seconds 38 | cutoff: { 39 | maxFrequency: 7500, // in hertz 40 | attack: 0.1, // in seconds 41 | decay: 2.5, // in seconds 42 | sustain: 0.2 // 0-5; maxFrequency multiplied by this 43 | } 44 | }; 45 | 46 | var synth = new Monosynth(audioCtx, config); 47 | ``` 48 | 49 | ### Demo 50 | [Tiles: a musical, multiplayer web toy](http://okaybenji.github.io/tiles-client/) 51 | -------------------------------------------------------------------------------- /src/v2/node_modules/ultron/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | .tern-port 4 | -------------------------------------------------------------------------------- /src/v2/node_modules/ultron/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - "0.12" 5 | - "0.10" 6 | - "0.8" 7 | - "iojs" 8 | before_install: 9 | - 'if [ "${TRAVIS_NODE_VERSION}" == "0.8" ]; then npm install -g npm@2.11.1; fi' 10 | script: 11 | - "npm run test-travis" 12 | after_script: 13 | - "npm install coveralls@2.11.x && cat coverage/lcov.info | coveralls" 14 | matrix: 15 | fast_finish: true 16 | notifications: 17 | irc: 18 | channels: 19 | - "irc.freenode.org#unshift" 20 | on_success: change 21 | on_failure: change 22 | -------------------------------------------------------------------------------- /src/v2/node_modules/ultron/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Unshift.io, Arnout Kazemier, the Contributors. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/v2/node_modules/ws/.npmignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | node_modules 3 | .*.swp 4 | .lock-* 5 | build 6 | 7 | bench 8 | doc 9 | examples 10 | test 11 | 12 | -------------------------------------------------------------------------------- /src/v2/node_modules/ws/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | sudo: false 3 | node_js: 4 | - "5" 5 | - "4" 6 | - "0.12" 7 | addons: 8 | apt: 9 | sources: 10 | - ubuntu-toolchain-r-test 11 | packages: 12 | - gcc-4.9 13 | - g++-4.9 14 | before_install: 15 | - export CC="gcc-4.9" CXX="g++-4.9" 16 | -------------------------------------------------------------------------------- /src/v2/node_modules/ws/Makefile: -------------------------------------------------------------------------------- 1 | ALL_TESTS = $(shell find test/ -name '*.test.js') 2 | ALL_INTEGRATION = $(shell find test/ -name '*.integration.js') 3 | 4 | run-tests: 5 | @./node_modules/.bin/mocha \ 6 | -t 5000 \ 7 | -s 2400 \ 8 | $(TESTFLAGS) \ 9 | $(TESTS) 10 | 11 | run-integrationtests: 12 | @./node_modules/.bin/mocha \ 13 | -t 5000 \ 14 | -s 6000 \ 15 | $(TESTFLAGS) \ 16 | $(TESTS) 17 | 18 | run-coverage: 19 | @./node_modules/.bin/istanbul cover --report html \ 20 | ./node_modules/.bin/_mocha -- \ 21 | -t 5000 \ 22 | -s 6000 \ 23 | $(TESTFLAGS) \ 24 | $(TESTS) 25 | 26 | test: 27 | @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests 28 | 29 | integrationtest: 30 | @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_INTEGRATION)" run-integrationtests 31 | 32 | coverage: 33 | @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_TESTS)" run-coverage 34 | 35 | benchmark: 36 | @node bench/sender.benchmark.js 37 | @node bench/parser.benchmark.js 38 | 39 | autobahn: 40 | @NODE_PATH=lib node test/autobahn.js 41 | 42 | autobahn-server: 43 | @NODE_PATH=lib node test/autobahn-server.js 44 | 45 | .PHONY: test coverage 46 | -------------------------------------------------------------------------------- /src/v2/node_modules/ws/SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Guidelines 2 | 3 | Please contact us directly at **security@3rd-Eden.com** for any bug that might 4 | impact the security of this project. Please prefix the subject of your email 5 | with `[security]` in lowercase and square brackets. Our email filters will 6 | automatically prevent these messages from being moved to our spam box. 7 | 8 | You will receive an acknowledgement of your report within **24 hours**. 9 | 10 | All emails that do not include security vulnerabilities will be removed and 11 | blocked instantly. 12 | 13 | ## Exceptions 14 | 15 | If you do not receive an acknowledgement within the said time frame please give 16 | us the benefit of the doubt as it's possible that we haven't seen it yet. In 17 | this case please send us a message **without details** using one of the 18 | following methods: 19 | 20 | - Contact the lead developers of this project on their personal e-mails. You 21 | can find the e-mails in the git logs, for example using the following command: 22 | `git --no-pager show -s --format='%an <%ae>' ` where `` is the 23 | SHA1 of their latest commit in the project. 24 | - Create a GitHub issue stating contact details and the severity of the issue. 25 | 26 | Once we have acknowledged receipt of your report and confirmed the bug 27 | ourselves we will work with you to fix the vulnerability and publicly acknowledge 28 | your responsible disclosure, if you wish. In addition to that we will report 29 | all vulnerabilities to the [Node Security Project](https://nodesecurity.io/). 30 | 31 | ## History 32 | 33 | 04 Jan 2016: [Buffer vulnerablity](https://github.com/websockets/ws/releases/tag/1.0.1) 34 | -------------------------------------------------------------------------------- /src/v2/node_modules/ws/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /*! 4 | * ws: a node.js websocket client 5 | * Copyright(c) 2011 Einar Otto Stangvik 6 | * MIT Licensed 7 | */ 8 | 9 | var WS = module.exports = require('./lib/WebSocket'); 10 | 11 | WS.Server = require('./lib/WebSocketServer'); 12 | WS.Sender = require('./lib/Sender'); 13 | WS.Receiver = require('./lib/Receiver'); 14 | 15 | /** 16 | * Create a new WebSocket server. 17 | * 18 | * @param {Object} options Server options 19 | * @param {Function} fn Optional connection listener. 20 | * @returns {WS.Server} 21 | * @api public 22 | */ 23 | WS.createServer = function createServer(options, fn) { 24 | var server = new WS.Server(options); 25 | 26 | if (typeof fn === 'function') { 27 | server.on('connection', fn); 28 | } 29 | 30 | return server; 31 | }; 32 | 33 | /** 34 | * Create a new WebSocket connection. 35 | * 36 | * @param {String} address The URL/address we need to connect to. 37 | * @param {Function} fn Open listener. 38 | * @returns {WS} 39 | * @api public 40 | */ 41 | WS.connect = WS.createConnection = function connect(address, fn) { 42 | var client = new WS(address); 43 | 44 | if (typeof fn === 'function') { 45 | client.on('open', fn); 46 | } 47 | 48 | return client; 49 | }; 50 | -------------------------------------------------------------------------------- /src/v2/node_modules/ws/lib/BufferPool.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | var util = require('util'); 8 | 9 | function BufferPool(initialSize, growStrategy, shrinkStrategy) { 10 | if (this instanceof BufferPool === false) { 11 | throw new TypeError("Classes can't be function-called"); 12 | } 13 | 14 | if (typeof initialSize === 'function') { 15 | shrinkStrategy = growStrategy; 16 | growStrategy = initialSize; 17 | initialSize = 0; 18 | } 19 | else if (typeof initialSize === 'undefined') { 20 | initialSize = 0; 21 | } 22 | this._growStrategy = (growStrategy || function(db, size) { 23 | return db.used + size; 24 | }).bind(null, this); 25 | this._shrinkStrategy = (shrinkStrategy || function(db) { 26 | return initialSize; 27 | }).bind(null, this); 28 | this._buffer = initialSize ? new Buffer(initialSize) : null; 29 | this._offset = 0; 30 | this._used = 0; 31 | this._changeFactor = 0; 32 | this.__defineGetter__('size', function(){ 33 | return this._buffer == null ? 0 : this._buffer.length; 34 | }); 35 | this.__defineGetter__('used', function(){ 36 | return this._used; 37 | }); 38 | } 39 | 40 | BufferPool.prototype.get = function(length) { 41 | if (this._buffer == null || this._offset + length > this._buffer.length) { 42 | var newBuf = new Buffer(this._growStrategy(length)); 43 | this._buffer = newBuf; 44 | this._offset = 0; 45 | } 46 | this._used += length; 47 | var buf = this._buffer.slice(this._offset, this._offset + length); 48 | this._offset += length; 49 | return buf; 50 | } 51 | 52 | BufferPool.prototype.reset = function(forceNewBuffer) { 53 | var len = this._shrinkStrategy(); 54 | if (len < this.size) this._changeFactor -= 1; 55 | if (forceNewBuffer || this._changeFactor < -2) { 56 | this._changeFactor = 0; 57 | this._buffer = len ? new Buffer(len) : null; 58 | } 59 | this._offset = 0; 60 | this._used = 0; 61 | } 62 | 63 | module.exports = BufferPool; 64 | -------------------------------------------------------------------------------- /src/v2/node_modules/ws/lib/BufferUtil.fallback.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | exports.BufferUtil = { 8 | merge: function(mergedBuffer, buffers) { 9 | var offset = 0; 10 | for (var i = 0, l = buffers.length; i < l; ++i) { 11 | var buf = buffers[i]; 12 | buf.copy(mergedBuffer, offset); 13 | offset += buf.length; 14 | } 15 | }, 16 | mask: function(source, mask, output, offset, length) { 17 | var maskNum = mask.readUInt32LE(0, true); 18 | var i = 0; 19 | for (; i < length - 3; i += 4) { 20 | var num = maskNum ^ source.readUInt32LE(i, true); 21 | if (num < 0) num = 4294967296 + num; 22 | output.writeUInt32LE(num, offset + i, true); 23 | } 24 | switch (length % 4) { 25 | case 3: output[offset + i + 2] = source[i + 2] ^ mask[2]; 26 | case 2: output[offset + i + 1] = source[i + 1] ^ mask[1]; 27 | case 1: output[offset + i] = source[i] ^ mask[0]; 28 | case 0:; 29 | } 30 | }, 31 | unmask: function(data, mask) { 32 | var maskNum = mask.readUInt32LE(0, true); 33 | var length = data.length; 34 | var i = 0; 35 | for (; i < length - 3; i += 4) { 36 | var num = maskNum ^ data.readUInt32LE(i, true); 37 | if (num < 0) num = 4294967296 + num; 38 | data.writeUInt32LE(num, i, true); 39 | } 40 | switch (length % 4) { 41 | case 3: data[i + 2] = data[i + 2] ^ mask[2]; 42 | case 2: data[i + 1] = data[i + 1] ^ mask[1]; 43 | case 1: data[i] = data[i] ^ mask[0]; 44 | case 0:; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/v2/node_modules/ws/lib/BufferUtil.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /*! 4 | * ws: a node.js websocket client 5 | * Copyright(c) 2011 Einar Otto Stangvik 6 | * MIT Licensed 7 | */ 8 | 9 | try { 10 | module.exports = require('bufferutil'); 11 | } catch (e) { 12 | module.exports = require('./BufferUtil.fallback'); 13 | } 14 | -------------------------------------------------------------------------------- /src/v2/node_modules/ws/lib/ErrorCodes.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | module.exports = { 8 | isValidErrorCode: function(code) { 9 | return (code >= 1000 && code <= 1011 && code != 1004 && code != 1005 && code != 1006) || 10 | (code >= 3000 && code <= 4999); 11 | }, 12 | 1000: 'normal', 13 | 1001: 'going away', 14 | 1002: 'protocol error', 15 | 1003: 'unsupported data', 16 | 1004: 'reserved', 17 | 1005: 'reserved for extensions', 18 | 1006: 'reserved for extensions', 19 | 1007: 'inconsistent or invalid data', 20 | 1008: 'policy violation', 21 | 1009: 'message too big', 22 | 1010: 'extension handshake missing', 23 | 1011: 'an unexpected condition prevented the request from being fulfilled', 24 | }; -------------------------------------------------------------------------------- /src/v2/node_modules/ws/lib/Extensions.js: -------------------------------------------------------------------------------- 1 | 2 | var util = require('util'); 3 | 4 | /** 5 | * Module exports. 6 | */ 7 | 8 | exports.parse = parse; 9 | exports.format = format; 10 | 11 | /** 12 | * Parse extensions header value 13 | */ 14 | 15 | function parse(value) { 16 | value = value || ''; 17 | 18 | var extensions = {}; 19 | 20 | value.split(',').forEach(function(v) { 21 | var params = v.split(';'); 22 | var token = params.shift().trim(); 23 | var paramsList = extensions[token] = extensions[token] || []; 24 | var parsedParams = {}; 25 | 26 | params.forEach(function(param) { 27 | var parts = param.trim().split('='); 28 | var key = parts[0]; 29 | var value = parts[1]; 30 | if (typeof value === 'undefined') { 31 | value = true; 32 | } else { 33 | // unquote value 34 | if (value[0] === '"') { 35 | value = value.slice(1); 36 | } 37 | if (value[value.length - 1] === '"') { 38 | value = value.slice(0, value.length - 1); 39 | } 40 | } 41 | (parsedParams[key] = parsedParams[key] || []).push(value); 42 | }); 43 | 44 | paramsList.push(parsedParams); 45 | }); 46 | 47 | return extensions; 48 | } 49 | 50 | /** 51 | * Format extensions header value 52 | */ 53 | 54 | function format(value) { 55 | return Object.keys(value).map(function(token) { 56 | var paramsList = value[token]; 57 | if (!util.isArray(paramsList)) { 58 | paramsList = [paramsList]; 59 | } 60 | return paramsList.map(function(params) { 61 | return [token].concat(Object.keys(params).map(function(k) { 62 | var p = params[k]; 63 | if (!util.isArray(p)) p = [p]; 64 | return p.map(function(v) { 65 | return v === true ? k : k + '=' + v; 66 | }).join('; '); 67 | })).join('; '); 68 | }).join(', '); 69 | }).join(', '); 70 | } 71 | -------------------------------------------------------------------------------- /src/v2/node_modules/ws/lib/Validation.fallback.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | exports.Validation = { 8 | isValidUTF8: function(buffer) { 9 | return true; 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /src/v2/node_modules/ws/lib/Validation.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /*! 4 | * ws: a node.js websocket client 5 | * Copyright(c) 2011 Einar Otto Stangvik 6 | * MIT Licensed 7 | */ 8 | 9 | try { 10 | module.exports = require('utf-8-validate'); 11 | } catch (e) { 12 | module.exports = require('./Validation.fallback'); 13 | } 14 | -------------------------------------------------------------------------------- /src/v2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Horizontally-Scaling-Node.js-Websockets-Talk", 3 | "description": "Talk about horizontally scaling node.js and WebSockets given at Connect.Tech 2016 and Thunder Plains 2016.", 4 | "author": "James Simpson (http://goldfirestudios.com)", 5 | "repository": { 6 | "type": "git", 7 | "url": "git://github.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk.git" 8 | }, 9 | "dependencies": { 10 | "submono": "*", 11 | "ws": "*" 12 | } 13 | } -------------------------------------------------------------------------------- /src/v2/server.js: -------------------------------------------------------------------------------- 1 | var WebSocketServer = require('ws').Server; 2 | var wss = new WebSocketServer({port: 2000}); 3 | 4 | wss.on('connection', function(ws) { 5 | ws.on('message', function(msg) { 6 | wss.clients.forEach(function(client) { 7 | client.send(msg); 8 | }); 9 | }); 10 | }); -------------------------------------------------------------------------------- /src/v3/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Horizontally Scaling Node.js & Websockets Demo 7 | 8 | 9 | 10 | 11 |
12 |
Click or touch window to play.
13 |
14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/v3/node_modules/double-ended-queue/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules/* 2 | todo.txt 3 | npm-debug.log 4 | test/* 5 | benchmark/* 6 | browser/* 7 | src/* 8 | async 9 | sync 10 | mixed 11 | bench.json 12 | js/browser 13 | js/browser/* 14 | js/debug 15 | js/debug/* 16 | reader.js 17 | read.txt 18 | bench 19 | .editorconfig 20 | .jshintrc 21 | ast_passes.js 22 | mocharun.js 23 | throwaway.js 24 | throwaway.html 25 | deque.sublime-workspace 26 | deque.sublime-project 27 | changelog.js 28 | .travis.yml 29 | sauce_connect.log 30 | nodex64.exe 31 | bump.js 32 | -------------------------------------------------------------------------------- /src/v3/node_modules/double-ended-queue/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Petka Antonov 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions:

9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /src/v3/node_modules/options/.npmignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | node_modules 3 | .*.swp 4 | .lock-* 5 | build/ 6 | 7 | test 8 | -------------------------------------------------------------------------------- /src/v3/node_modules/options/Makefile: -------------------------------------------------------------------------------- 1 | ALL_TESTS = $(shell find test/ -name '*.test.js') 2 | 3 | run-tests: 4 | @./node_modules/.bin/mocha \ 5 | -t 2000 \ 6 | $(TESTFLAGS) \ 7 | $(TESTS) 8 | 9 | test: 10 | @$(MAKE) NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests 11 | 12 | .PHONY: test 13 | -------------------------------------------------------------------------------- /src/v3/node_modules/options/README.md: -------------------------------------------------------------------------------- 1 | # options.js # 2 | 3 | A very light-weight in-code option parsers for node.js. 4 | 5 | ## Usage ## 6 | 7 | ``` js 8 | var Options = require("options"); 9 | 10 | // Create an Options object 11 | function foo(options) { 12 | var default_options = { 13 | foo : "bar" 14 | }; 15 | 16 | // Create an option object with default value 17 | var opts = new Options(default_options); 18 | 19 | // Merge options 20 | opts = opts.merge(options); 21 | 22 | // Reset to default value 23 | opts.reset(); 24 | 25 | // Copy selected attributes out 26 | var seled_att = opts.copy("foo"); 27 | 28 | // Read json options from a file. 29 | opts.read("options.file"); // Sync 30 | opts.read("options.file", function(err){ // Async 31 | if(err){ // If error occurs 32 | console.log("File error."); 33 | }else{ 34 | // No error 35 | } 36 | }); 37 | 38 | // Attributes defined or not 39 | opts.isDefinedAndNonNull("foobar"); 40 | opts.isDefined("foobar"); 41 | } 42 | 43 | ``` 44 | 45 | 46 | ## License ## 47 | 48 | (The MIT License) 49 | 50 | Copyright (c) 2012 Einar Otto Stangvik <einaros@gmail.com> 51 | 52 | Permission is hereby granted, free of charge, to any person obtaining 53 | a copy of this software and associated documentation files (the 54 | 'Software'), to deal in the Software without restriction, including 55 | without limitation the rights to use, copy, modify, merge, publish, 56 | distribute, sublicense, and/or sell copies of the Software, and to 57 | permit persons to whom the Software is furnished to do so, subject to 58 | the following conditions: 59 | 60 | The above copyright notice and this permission notice shall be 61 | included in all copies or substantial portions of the Software. 62 | 63 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 64 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 65 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 66 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 67 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 68 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 69 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 70 | -------------------------------------------------------------------------------- /src/v3/node_modules/redis-commands/.npmignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | *.rdb 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # Compiled binary addons (http://nodejs.org/api/addons.html) 21 | build/Release 22 | 23 | # Dependency directory 24 | # Commenting this out is preferred by some people, see 25 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- 26 | node_modules 27 | 28 | # Users Environment Variables 29 | .lock-wscript 30 | -------------------------------------------------------------------------------- /src/v3/node_modules/redis-commands/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | sudo: false 3 | node_js: 4 | - "0.10" 5 | - "0.12" 6 | - "4" 7 | - "5" 8 | after_success: 9 | - CODECLIMATE_REPO_TOKEN=b57723fafcf0516f275d6b380cd506fd082ea88d86507eb82c8abd489b9b9a09 node ./node_modules/.bin/codeclimate-test-reporter < coverage/lcov.info 10 | -------------------------------------------------------------------------------- /src/v3/node_modules/redis-commands/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 NodeRedis 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/v3/node_modules/redis-commands/README.md: -------------------------------------------------------------------------------- 1 | # Redis Commands 2 | 3 | [![Build Status](https://travis-ci.org/NodeRedis/redis-commands.png?branch=master)](https://travis-ci.org/NodeRedis/redis-commands) 4 | [![Code Climate](https://codeclimate.com/github/NodeRedis/redis-commands/badges/gpa.svg)](https://codeclimate.com/github/NodeRedis/redis-commands) 5 | [![Test Coverage](https://codeclimate.com/github/NodeRedis/redis-commands/badges/coverage.svg)](https://codeclimate.com/github/NodeRedis/redis-commands/coverage) 6 | 7 | This module exports all the commands that Redis supports. 8 | 9 | ## Install 10 | 11 | ```shell 12 | $ npm install redis-commands 13 | ``` 14 | 15 | ## Usage 16 | 17 | ```javascript 18 | var commands = require('redis-commands'); 19 | ``` 20 | 21 | `.list` is an array contains all the lowercased commands: 22 | 23 | ```javascript 24 | commands.list.forEach(function (command) { 25 | console.log(command); 26 | }); 27 | ``` 28 | 29 | `.exists()` is used to check if the command exists: 30 | 31 | ```javascript 32 | commands.exists('set') // true 33 | commands.exists('other-command') // false 34 | ``` 35 | 36 | `.hasFlag()` is used to check if the command has the flag: 37 | 38 | ```javascript 39 | commands.hasFlag('set', 'readonly') // false 40 | ``` 41 | 42 | `.getKeyIndexes()` is used to get the indexes of keys in the command arguments: 43 | 44 | ```javascript 45 | commands.getKeyIndexes('set', ['key', 'value']) // [0] 46 | commands.getKeyIndexes('mget', ['key1', 'key2']) // [0, 1] 47 | ``` 48 | 49 | ## Acknowledgment 50 | 51 | Thank [@Yuan Chuan](https://github.com/yuanchuan) for the package name. The original redis-commands is renamed to [@yuanchuan/redis-commands](https://www.npmjs.com/package/@yuanchuan/redis-commands). 52 | -------------------------------------------------------------------------------- /src/v3/node_modules/redis-commands/changelog.md: -------------------------------------------------------------------------------- 1 | ## v.1.2.0 - 21 Apr, 2016 2 | 3 | Features 4 | 5 | - Added support for `MIGRATE [...] KEYS key1, key2` (Redis >= v.3.0.6) 6 | - Added build sanity check for unhandled commands with moveable keys 7 | - Rebuild the commands with the newest unstable release 8 | - Improved performance of .getKeyIndexes() 9 | 10 | Bugfix 11 | 12 | - Fixed command command returning the wrong arity due to a Redis bug 13 | - Fixed brpop command returning the wrong keystop due to a Redis bug 14 | 15 | ## v.1.1.0 - 09 Feb, 2016 16 | 17 | Features 18 | 19 | - Added .exists() to check for command existence 20 | - Improved performance of .hasFlag() 21 | -------------------------------------------------------------------------------- /src/v3/node_modules/redis-commands/tools/build.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var path = require('path'); 3 | var stringify = require('json-stable-stringify'); 4 | var commandPath = path.join(__dirname, '..', 'commands.json'); 5 | var redisCommands = require('../'); 6 | 7 | var Redis = require('ioredis'); 8 | var redis = new Redis(process.env.REDIS_URI); 9 | 10 | redis.command().then(function (res) { 11 | redis.disconnect(); 12 | 13 | // Find all special handled cases 14 | var movableKeys = String(redisCommands.getKeyIndexes).match(/case '[a-z-]+':/g).map(function (entry) { 15 | return entry.replace(/^case \'|\':$/g, ''); 16 | }); 17 | 18 | var commands = res.reduce(function (prev, current) { 19 | var currentCommandPos = movableKeys.indexOf(current[0]); 20 | if (currentCommandPos !== -1 && current[2].indexOf('movablekeys') !== -1) { 21 | movableKeys.splice(currentCommandPos, 1); 22 | } 23 | // https://github.com/antirez/redis/issues/2598 24 | if (current[0] === 'brpop' && current[4] === 1) { 25 | current[4] = -2; 26 | } 27 | prev[current[0]] = { 28 | arity: current[1] || 1, // https://github.com/antirez/redis/pull/2986 29 | flags: current[2], 30 | keyStart: current[3], 31 | keyStop: current[4], 32 | step: current[5] 33 | }; 34 | return prev; 35 | }, {}); 36 | 37 | // Future proof. Redis might implement this at some point 38 | // https://github.com/antirez/redis/pull/2982 39 | if (!commands.quit) { 40 | commands.quit = { 41 | arity: 1, 42 | flags: [ 43 | 'loading', 44 | 'stale', 45 | 'readonly' 46 | ], 47 | keyStart: 0, 48 | keyStop: 0, 49 | step: 0 50 | } 51 | } 52 | 53 | if (movableKeys.length !== 0) { 54 | throw new Error('Not all commands (\'' + movableKeys.join('\', \'') + '\') with the "movablekeys" flag are handled in the code'); 55 | } 56 | 57 | // Use json-stable-stringify instead fo JSON.stringify 58 | // for easier diffing 59 | var content = stringify(commands, { space: ' ' }); 60 | 61 | fs.writeFile(commandPath, content); 62 | }); 63 | -------------------------------------------------------------------------------- /src/v3/node_modules/redis-parser/.codeclimate.yml: -------------------------------------------------------------------------------- 1 | languages: 2 | JavaScript: true 3 | exclude_paths: 4 | - "benchmark/index.js" 5 | - "benchmark/old/javascript.js" 6 | - "test/parsers.spec.js" 7 | -------------------------------------------------------------------------------- /src/v3/node_modules/redis-parser/.npmignore: -------------------------------------------------------------------------------- 1 | # IntelliJ project files 2 | .idea 3 | *.iml 4 | out 5 | gen 6 | 7 | # Unrelevant files and folders 8 | benchmark 9 | coverage 10 | test 11 | .travis.yml 12 | .gitignore 13 | -------------------------------------------------------------------------------- /src/v3/node_modules/redis-parser/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 NodeRedis 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/v3/node_modules/redis-parser/changelog.md: -------------------------------------------------------------------------------- 1 | ## v.2.0.4 - 21 Jul, 2016 2 | 3 | Bugfixes 4 | 5 | - Fixed multi byte characters getting corrupted 6 | 7 | ## v.2.0.3 - 17 Jun, 2016 8 | 9 | Bugfixes 10 | 11 | - Fixed parser not working with huge buffers (e.g. 300 MB) 12 | 13 | ## v.2.0.2 - 08 Jun, 2016 14 | 15 | Bugfixes 16 | 17 | - Fixed parser with returnBuffers option returning corrupted data 18 | 19 | ## v.2.0.1 - 04 Jun, 2016 20 | 21 | Bugfixes 22 | 23 | - Fixed multiple parsers working concurrently resulting in faulty data in some cases 24 | 25 | ## v.2.0.0 - 29 May, 2016 26 | 27 | The javascript parser got completly rewritten by [Michael Diarmid](https://github.com/Salakar) and [Ruben Bridgewater](https://github.com/BridgeAR) and is now a lot faster than the hiredis parser. 28 | Therefore the hiredis parser was deprecated and should only be used for testing purposes and benchmarking comparison. 29 | 30 | All Errors returned by the parser are from now on of class ReplyError 31 | 32 | Features 33 | 34 | - Improved performance by up to 15x as fast as before 35 | - Improved options validation 36 | - Added ReplyError Class 37 | - Added parser benchmark 38 | - Switched default parser from hiredis to JS, no matter if hiredis is installed or not 39 | 40 | Removed 41 | 42 | - Deprecated hiredis support 43 | 44 | ## v.1.3.0 - 27 Mar, 2016 45 | 46 | Features 47 | 48 | - Added `auto` as parser name option to check what parser is available 49 | - Non existing requested parsers falls back into auto mode instead of always choosing the JS parser 50 | 51 | ## v.1.2.0 - 27 Mar, 2016 52 | 53 | Features 54 | 55 | - Added `stringNumbers` option to make sure all numbers are returned as string instead of a js number for precision 56 | - The parser is from now on going to print warnings if a parser is explicitly requested that does not exist and gracefully chooses the JS parser 57 | 58 | ## v.1.1.0 - 26 Jan, 2016 59 | 60 | Features 61 | 62 | - The parser is from now on going to reset itself on protocol errors 63 | -------------------------------------------------------------------------------- /src/v3/node_modules/redis-parser/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | module.exports = require('./lib/parser') 4 | module.exports.ReplyError = require('./lib/replyError') 5 | -------------------------------------------------------------------------------- /src/v3/node_modules/redis-parser/lib/hiredis.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | var hiredis = require('hiredis') 4 | var ReplyError = require('../lib/replyError') 5 | 6 | /** 7 | * Parse data 8 | * @param parser 9 | * @returns {*} 10 | */ 11 | function parseData (parser) { 12 | try { 13 | return parser.reader.get() 14 | } catch (err) { 15 | // Protocol errors land here 16 | // Reset the parser. Otherwise new commands can't be processed properly 17 | parser.reader = new hiredis.Reader(parser.options) 18 | parser.returnFatalError(new ReplyError(err.message)) 19 | } 20 | } 21 | 22 | /** 23 | * Hiredis Parser 24 | * @param options 25 | * @constructor 26 | */ 27 | function HiredisReplyParser (options) { 28 | this.returnError = options.returnError 29 | this.returnFatalError = options.returnFatalError || options.returnError 30 | this.returnReply = options.returnReply 31 | this.name = 'hiredis' 32 | this.options = { 33 | return_buffers: !!options.returnBuffers 34 | } 35 | this.reader = new hiredis.Reader(this.options) 36 | } 37 | 38 | HiredisReplyParser.prototype.execute = function (data) { 39 | this.reader.feed(data) 40 | var reply = parseData(this) 41 | 42 | while (reply !== undefined) { 43 | if (reply && reply.name === 'Error') { 44 | this.returnError(new ReplyError(reply.message)) 45 | } else { 46 | this.returnReply(reply) 47 | } 48 | reply = parseData(this) 49 | } 50 | } 51 | 52 | module.exports = HiredisReplyParser 53 | -------------------------------------------------------------------------------- /src/v3/node_modules/redis-parser/lib/replyError.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | var util = require('util') 4 | 5 | function ReplyError (message) { 6 | var limit = Error.stackTraceLimit 7 | Error.stackTraceLimit = 2 8 | Error.captureStackTrace(this, this.constructor) 9 | Error.stackTraceLimit = limit 10 | Object.defineProperty(this, 'message', { 11 | value: message || '', 12 | writable: true 13 | }) 14 | } 15 | 16 | util.inherits(ReplyError, Error) 17 | 18 | Object.defineProperty(ReplyError.prototype, 'name', { 19 | value: 'ReplyError', 20 | writable: true 21 | }) 22 | 23 | module.exports = ReplyError 24 | -------------------------------------------------------------------------------- /src/v3/node_modules/redis/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules/** 2 | coverage/** 3 | **.md 4 | **.log 5 | -------------------------------------------------------------------------------- /src/v3/node_modules/redis/.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | _Thanks for wanting to report an issue you've found in node_redis. Please delete 2 | this text and fill in the template below. Please note that the issue tracker is only 3 | for bug reports or feature requests. If you have a question, please ask that on [gitter]. 4 | If unsure about something, just do as best as you're able._ 5 | 6 | _Note that it will be much easier to fix the issue if a test case that reproduces 7 | the problem is provided. It is of course not always possible to reduce your code 8 | to a small test case, but it's highly appreciated to have as much data as possible. 9 | Thank you!_ 10 | 11 | * **Version**: What node_redis and what redis version is the issue happening on? 12 | * **Platform**: What platform / version? (For example Node.js 0.10 or Node.js 5.7.0 on Windows 7 / Ubuntu 15.10 / Azure) 13 | * **Description**: Description of your issue, stack traces from errors and code that reproduces the issue 14 | 15 | [gitter]: https://gitter.im/NodeRedis/node_redis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge -------------------------------------------------------------------------------- /src/v3/node_modules/redis/.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Pull Request check-list 2 | 3 | _Please make sure to review and check all of these items:_ 4 | 5 | - [ ] Does `npm test` pass with this change (including linting)? 6 | - [ ] Is the new or changed code fully tested? 7 | - [ ] Is a documentation update included (if this change modifies existing APIs, or introduces new ones)? 8 | 9 | _NOTE: these things are not required to open a PR and can be done 10 | afterwards / while the PR is open._ 11 | 12 | ### Description of change 13 | 14 | _Please provide a description of the change here._ -------------------------------------------------------------------------------- /src/v3/node_modules/redis/.npmignore: -------------------------------------------------------------------------------- 1 | examples/ 2 | benchmarks/ 3 | test/ 4 | .nyc_output/ 5 | coverage/ 6 | .tern-port 7 | *.log 8 | *.rdb 9 | *.out 10 | *.yml 11 | -------------------------------------------------------------------------------- /src/v3/node_modules/redis/LICENSE: -------------------------------------------------------------------------------- 1 | LICENSE - "MIT License" 2 | 3 | Copyright (c) 2016 by NodeRedis 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the "Software"), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /src/v3/node_modules/redis/lib/command.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var betterStackTraces = /development/i.test(process.env.NODE_ENV) || /\bredis\b/i.test(process.env.NODE_DEBUG); 4 | 5 | function Command (command, args, callback, call_on_write) { 6 | this.command = command; 7 | this.args = args; 8 | this.buffer_args = false; 9 | this.callback = callback; 10 | this.call_on_write = call_on_write; 11 | if (betterStackTraces) { 12 | this.error = new Error(); 13 | } 14 | } 15 | 16 | module.exports = Command; 17 | -------------------------------------------------------------------------------- /src/v3/node_modules/redis/lib/customErrors.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var util = require('util'); 4 | 5 | function AbortError (obj) { 6 | Error.captureStackTrace(this, this.constructor); 7 | Object.defineProperty(this, 'message', { 8 | value: obj.message || '', 9 | configurable: true, 10 | writable: true 11 | }); 12 | for (var keys = Object.keys(obj), key = keys.pop(); key; key = keys.pop()) { 13 | this[key] = obj[key]; 14 | } 15 | } 16 | 17 | function AggregateError (obj) { 18 | Error.captureStackTrace(this, this.constructor); 19 | Object.defineProperty(this, 'message', { 20 | value: obj.message || '', 21 | configurable: true, 22 | writable: true 23 | }); 24 | for (var keys = Object.keys(obj), key = keys.pop(); key; key = keys.pop()) { 25 | this[key] = obj[key]; 26 | } 27 | } 28 | 29 | util.inherits(AbortError, Error); 30 | util.inherits(AggregateError, AbortError); 31 | 32 | Object.defineProperty(AbortError.prototype, 'name', { 33 | value: 'AbortError', 34 | // configurable: true, 35 | writable: true 36 | }); 37 | Object.defineProperty(AggregateError.prototype, 'name', { 38 | value: 'AggregateError', 39 | // configurable: true, 40 | writable: true 41 | }); 42 | 43 | module.exports = { 44 | AbortError: AbortError, 45 | AggregateError: AggregateError 46 | }; 47 | -------------------------------------------------------------------------------- /src/v3/node_modules/redis/lib/debug.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var index = require('../'); 4 | 5 | function debug () { 6 | if (index.debug_mode) { 7 | console.error.apply(null, arguments); 8 | } 9 | } 10 | 11 | module.exports = debug; 12 | -------------------------------------------------------------------------------- /src/v3/node_modules/submono/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Benji Kay 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/v3/node_modules/submono/README.md: -------------------------------------------------------------------------------- 1 | # submono 2 | A Web Audio subtractive, monophonic synthesizer. Looking for polyphony? Check out [subpoly](https://github.com/okaybenji/subpoly)! 3 | 4 | ### Create a synth. 5 | ``` 6 | var audioCtx = new AudioContext(); 7 | var synth = new Monosynth(audioCtx); 8 | ``` 9 | 10 | ### Play a note. 11 | `synth.start();` 12 | 13 | ### Stop playing. 14 | `synth.stop();` 15 | 16 | ### Use methods to access pitch and waveform... 17 | ``` 18 | synth.pitch(440); // in hertz 19 | console.log(synth.waveform()); // 'sawtooth' (or sine, triangle, square) 20 | ``` 21 | 22 | ### ...get or set any other properties directly. 23 | ``` 24 | synth.maxGain = 0.5; // out of 1 25 | synth.attack = 1.0; // in seconds 26 | ``` 27 | 28 | ### Configure any or all the properties on initialization. 29 | ``` 30 | var config = { 31 | waveform: 'sawtooth', // or sine, triangle, square 32 | pitch: 440, // in hertz 33 | maxGain: 0.5, // out of 1 34 | attack: 0.1, // in seconds 35 | decay: 0.0, // in seconds 36 | sustain: 1.0, // out of 1 37 | release: 0.8, // in seconds 38 | cutoff: { 39 | maxFrequency: 7500, // in hertz 40 | attack: 0.1, // in seconds 41 | decay: 2.5, // in seconds 42 | sustain: 0.2 // 0-5; maxFrequency multiplied by this 43 | } 44 | }; 45 | 46 | var synth = new Monosynth(audioCtx, config); 47 | ``` 48 | 49 | ### Demo 50 | [Tiles: a musical, multiplayer web toy](http://okaybenji.github.io/tiles-client/) 51 | -------------------------------------------------------------------------------- /src/v3/node_modules/ultron/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | .tern-port 4 | -------------------------------------------------------------------------------- /src/v3/node_modules/ultron/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - "0.12" 5 | - "0.10" 6 | - "0.8" 7 | - "iojs" 8 | before_install: 9 | - 'if [ "${TRAVIS_NODE_VERSION}" == "0.8" ]; then npm install -g npm@2.11.1; fi' 10 | script: 11 | - "npm run test-travis" 12 | after_script: 13 | - "npm install coveralls@2.11.x && cat coverage/lcov.info | coveralls" 14 | matrix: 15 | fast_finish: true 16 | notifications: 17 | irc: 18 | channels: 19 | - "irc.freenode.org#unshift" 20 | on_success: change 21 | on_failure: change 22 | -------------------------------------------------------------------------------- /src/v3/node_modules/ultron/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Unshift.io, Arnout Kazemier, the Contributors. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/v3/node_modules/ws/.npmignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | node_modules 3 | .*.swp 4 | .lock-* 5 | build 6 | 7 | bench 8 | doc 9 | examples 10 | test 11 | 12 | -------------------------------------------------------------------------------- /src/v3/node_modules/ws/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | sudo: false 3 | node_js: 4 | - "5" 5 | - "4" 6 | - "0.12" 7 | addons: 8 | apt: 9 | sources: 10 | - ubuntu-toolchain-r-test 11 | packages: 12 | - gcc-4.9 13 | - g++-4.9 14 | before_install: 15 | - export CC="gcc-4.9" CXX="g++-4.9" 16 | -------------------------------------------------------------------------------- /src/v3/node_modules/ws/Makefile: -------------------------------------------------------------------------------- 1 | ALL_TESTS = $(shell find test/ -name '*.test.js') 2 | ALL_INTEGRATION = $(shell find test/ -name '*.integration.js') 3 | 4 | run-tests: 5 | @./node_modules/.bin/mocha \ 6 | -t 5000 \ 7 | -s 2400 \ 8 | $(TESTFLAGS) \ 9 | $(TESTS) 10 | 11 | run-integrationtests: 12 | @./node_modules/.bin/mocha \ 13 | -t 5000 \ 14 | -s 6000 \ 15 | $(TESTFLAGS) \ 16 | $(TESTS) 17 | 18 | run-coverage: 19 | @./node_modules/.bin/istanbul cover --report html \ 20 | ./node_modules/.bin/_mocha -- \ 21 | -t 5000 \ 22 | -s 6000 \ 23 | $(TESTFLAGS) \ 24 | $(TESTS) 25 | 26 | test: 27 | @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests 28 | 29 | integrationtest: 30 | @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_INTEGRATION)" run-integrationtests 31 | 32 | coverage: 33 | @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_TESTS)" run-coverage 34 | 35 | benchmark: 36 | @node bench/sender.benchmark.js 37 | @node bench/parser.benchmark.js 38 | 39 | autobahn: 40 | @NODE_PATH=lib node test/autobahn.js 41 | 42 | autobahn-server: 43 | @NODE_PATH=lib node test/autobahn-server.js 44 | 45 | .PHONY: test coverage 46 | -------------------------------------------------------------------------------- /src/v3/node_modules/ws/SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Guidelines 2 | 3 | Please contact us directly at **security@3rd-Eden.com** for any bug that might 4 | impact the security of this project. Please prefix the subject of your email 5 | with `[security]` in lowercase and square brackets. Our email filters will 6 | automatically prevent these messages from being moved to our spam box. 7 | 8 | You will receive an acknowledgement of your report within **24 hours**. 9 | 10 | All emails that do not include security vulnerabilities will be removed and 11 | blocked instantly. 12 | 13 | ## Exceptions 14 | 15 | If you do not receive an acknowledgement within the said time frame please give 16 | us the benefit of the doubt as it's possible that we haven't seen it yet. In 17 | this case please send us a message **without details** using one of the 18 | following methods: 19 | 20 | - Contact the lead developers of this project on their personal e-mails. You 21 | can find the e-mails in the git logs, for example using the following command: 22 | `git --no-pager show -s --format='%an <%ae>' ` where `` is the 23 | SHA1 of their latest commit in the project. 24 | - Create a GitHub issue stating contact details and the severity of the issue. 25 | 26 | Once we have acknowledged receipt of your report and confirmed the bug 27 | ourselves we will work with you to fix the vulnerability and publicly acknowledge 28 | your responsible disclosure, if you wish. In addition to that we will report 29 | all vulnerabilities to the [Node Security Project](https://nodesecurity.io/). 30 | 31 | ## History 32 | 33 | 04 Jan 2016: [Buffer vulnerablity](https://github.com/websockets/ws/releases/tag/1.0.1) 34 | -------------------------------------------------------------------------------- /src/v3/node_modules/ws/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /*! 4 | * ws: a node.js websocket client 5 | * Copyright(c) 2011 Einar Otto Stangvik 6 | * MIT Licensed 7 | */ 8 | 9 | var WS = module.exports = require('./lib/WebSocket'); 10 | 11 | WS.Server = require('./lib/WebSocketServer'); 12 | WS.Sender = require('./lib/Sender'); 13 | WS.Receiver = require('./lib/Receiver'); 14 | 15 | /** 16 | * Create a new WebSocket server. 17 | * 18 | * @param {Object} options Server options 19 | * @param {Function} fn Optional connection listener. 20 | * @returns {WS.Server} 21 | * @api public 22 | */ 23 | WS.createServer = function createServer(options, fn) { 24 | var server = new WS.Server(options); 25 | 26 | if (typeof fn === 'function') { 27 | server.on('connection', fn); 28 | } 29 | 30 | return server; 31 | }; 32 | 33 | /** 34 | * Create a new WebSocket connection. 35 | * 36 | * @param {String} address The URL/address we need to connect to. 37 | * @param {Function} fn Open listener. 38 | * @returns {WS} 39 | * @api public 40 | */ 41 | WS.connect = WS.createConnection = function connect(address, fn) { 42 | var client = new WS(address); 43 | 44 | if (typeof fn === 'function') { 45 | client.on('open', fn); 46 | } 47 | 48 | return client; 49 | }; 50 | -------------------------------------------------------------------------------- /src/v3/node_modules/ws/lib/BufferPool.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | var util = require('util'); 8 | 9 | function BufferPool(initialSize, growStrategy, shrinkStrategy) { 10 | if (this instanceof BufferPool === false) { 11 | throw new TypeError("Classes can't be function-called"); 12 | } 13 | 14 | if (typeof initialSize === 'function') { 15 | shrinkStrategy = growStrategy; 16 | growStrategy = initialSize; 17 | initialSize = 0; 18 | } 19 | else if (typeof initialSize === 'undefined') { 20 | initialSize = 0; 21 | } 22 | this._growStrategy = (growStrategy || function(db, size) { 23 | return db.used + size; 24 | }).bind(null, this); 25 | this._shrinkStrategy = (shrinkStrategy || function(db) { 26 | return initialSize; 27 | }).bind(null, this); 28 | this._buffer = initialSize ? new Buffer(initialSize) : null; 29 | this._offset = 0; 30 | this._used = 0; 31 | this._changeFactor = 0; 32 | this.__defineGetter__('size', function(){ 33 | return this._buffer == null ? 0 : this._buffer.length; 34 | }); 35 | this.__defineGetter__('used', function(){ 36 | return this._used; 37 | }); 38 | } 39 | 40 | BufferPool.prototype.get = function(length) { 41 | if (this._buffer == null || this._offset + length > this._buffer.length) { 42 | var newBuf = new Buffer(this._growStrategy(length)); 43 | this._buffer = newBuf; 44 | this._offset = 0; 45 | } 46 | this._used += length; 47 | var buf = this._buffer.slice(this._offset, this._offset + length); 48 | this._offset += length; 49 | return buf; 50 | } 51 | 52 | BufferPool.prototype.reset = function(forceNewBuffer) { 53 | var len = this._shrinkStrategy(); 54 | if (len < this.size) this._changeFactor -= 1; 55 | if (forceNewBuffer || this._changeFactor < -2) { 56 | this._changeFactor = 0; 57 | this._buffer = len ? new Buffer(len) : null; 58 | } 59 | this._offset = 0; 60 | this._used = 0; 61 | } 62 | 63 | module.exports = BufferPool; 64 | -------------------------------------------------------------------------------- /src/v3/node_modules/ws/lib/BufferUtil.fallback.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | exports.BufferUtil = { 8 | merge: function(mergedBuffer, buffers) { 9 | var offset = 0; 10 | for (var i = 0, l = buffers.length; i < l; ++i) { 11 | var buf = buffers[i]; 12 | buf.copy(mergedBuffer, offset); 13 | offset += buf.length; 14 | } 15 | }, 16 | mask: function(source, mask, output, offset, length) { 17 | var maskNum = mask.readUInt32LE(0, true); 18 | var i = 0; 19 | for (; i < length - 3; i += 4) { 20 | var num = maskNum ^ source.readUInt32LE(i, true); 21 | if (num < 0) num = 4294967296 + num; 22 | output.writeUInt32LE(num, offset + i, true); 23 | } 24 | switch (length % 4) { 25 | case 3: output[offset + i + 2] = source[i + 2] ^ mask[2]; 26 | case 2: output[offset + i + 1] = source[i + 1] ^ mask[1]; 27 | case 1: output[offset + i] = source[i] ^ mask[0]; 28 | case 0:; 29 | } 30 | }, 31 | unmask: function(data, mask) { 32 | var maskNum = mask.readUInt32LE(0, true); 33 | var length = data.length; 34 | var i = 0; 35 | for (; i < length - 3; i += 4) { 36 | var num = maskNum ^ data.readUInt32LE(i, true); 37 | if (num < 0) num = 4294967296 + num; 38 | data.writeUInt32LE(num, i, true); 39 | } 40 | switch (length % 4) { 41 | case 3: data[i + 2] = data[i + 2] ^ mask[2]; 42 | case 2: data[i + 1] = data[i + 1] ^ mask[1]; 43 | case 1: data[i] = data[i] ^ mask[0]; 44 | case 0:; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/v3/node_modules/ws/lib/BufferUtil.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /*! 4 | * ws: a node.js websocket client 5 | * Copyright(c) 2011 Einar Otto Stangvik 6 | * MIT Licensed 7 | */ 8 | 9 | try { 10 | module.exports = require('bufferutil'); 11 | } catch (e) { 12 | module.exports = require('./BufferUtil.fallback'); 13 | } 14 | -------------------------------------------------------------------------------- /src/v3/node_modules/ws/lib/ErrorCodes.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | module.exports = { 8 | isValidErrorCode: function(code) { 9 | return (code >= 1000 && code <= 1011 && code != 1004 && code != 1005 && code != 1006) || 10 | (code >= 3000 && code <= 4999); 11 | }, 12 | 1000: 'normal', 13 | 1001: 'going away', 14 | 1002: 'protocol error', 15 | 1003: 'unsupported data', 16 | 1004: 'reserved', 17 | 1005: 'reserved for extensions', 18 | 1006: 'reserved for extensions', 19 | 1007: 'inconsistent or invalid data', 20 | 1008: 'policy violation', 21 | 1009: 'message too big', 22 | 1010: 'extension handshake missing', 23 | 1011: 'an unexpected condition prevented the request from being fulfilled', 24 | }; -------------------------------------------------------------------------------- /src/v3/node_modules/ws/lib/Extensions.js: -------------------------------------------------------------------------------- 1 | 2 | var util = require('util'); 3 | 4 | /** 5 | * Module exports. 6 | */ 7 | 8 | exports.parse = parse; 9 | exports.format = format; 10 | 11 | /** 12 | * Parse extensions header value 13 | */ 14 | 15 | function parse(value) { 16 | value = value || ''; 17 | 18 | var extensions = {}; 19 | 20 | value.split(',').forEach(function(v) { 21 | var params = v.split(';'); 22 | var token = params.shift().trim(); 23 | var paramsList = extensions[token] = extensions[token] || []; 24 | var parsedParams = {}; 25 | 26 | params.forEach(function(param) { 27 | var parts = param.trim().split('='); 28 | var key = parts[0]; 29 | var value = parts[1]; 30 | if (typeof value === 'undefined') { 31 | value = true; 32 | } else { 33 | // unquote value 34 | if (value[0] === '"') { 35 | value = value.slice(1); 36 | } 37 | if (value[value.length - 1] === '"') { 38 | value = value.slice(0, value.length - 1); 39 | } 40 | } 41 | (parsedParams[key] = parsedParams[key] || []).push(value); 42 | }); 43 | 44 | paramsList.push(parsedParams); 45 | }); 46 | 47 | return extensions; 48 | } 49 | 50 | /** 51 | * Format extensions header value 52 | */ 53 | 54 | function format(value) { 55 | return Object.keys(value).map(function(token) { 56 | var paramsList = value[token]; 57 | if (!util.isArray(paramsList)) { 58 | paramsList = [paramsList]; 59 | } 60 | return paramsList.map(function(params) { 61 | return [token].concat(Object.keys(params).map(function(k) { 62 | var p = params[k]; 63 | if (!util.isArray(p)) p = [p]; 64 | return p.map(function(v) { 65 | return v === true ? k : k + '=' + v; 66 | }).join('; '); 67 | })).join('; '); 68 | }).join(', '); 69 | }).join(', '); 70 | } 71 | -------------------------------------------------------------------------------- /src/v3/node_modules/ws/lib/Validation.fallback.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | exports.Validation = { 8 | isValidUTF8: function(buffer) { 9 | return true; 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /src/v3/node_modules/ws/lib/Validation.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /*! 4 | * ws: a node.js websocket client 5 | * Copyright(c) 2011 Einar Otto Stangvik 6 | * MIT Licensed 7 | */ 8 | 9 | try { 10 | module.exports = require('utf-8-validate'); 11 | } catch (e) { 12 | module.exports = require('./Validation.fallback'); 13 | } 14 | -------------------------------------------------------------------------------- /src/v3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Horizontally-Scaling-Node.js-Websockets-Talk", 3 | "description": "Talk about horizontally scaling node.js and WebSockets given at Connect.Tech 2016 and Thunder Plains 2016.", 4 | "author": "James Simpson (http://goldfirestudios.com)", 5 | "repository": { 6 | "type": "git", 7 | "url": "git://github.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk.git" 8 | }, 9 | "dependencies": { 10 | "submono": "*", 11 | "ws": "*", 12 | "redis": "*" 13 | } 14 | } -------------------------------------------------------------------------------- /src/v3/server.js: -------------------------------------------------------------------------------- 1 | var port = parseInt(process.argv[2], 10); 2 | var WebSocketServer = require('ws').Server; 3 | var wss = new WebSocketServer({port: port}); 4 | var redis = require('redis'); 5 | var pub = redis.createClient(); 6 | var sub = redis.createClient(); 7 | 8 | sub.subscribe('global'); 9 | sub.on('message', function(channel, msg) { 10 | if (channel === 'global') { 11 | wss.clients.forEach(function(client) { 12 | client.send(msg); 13 | }); 14 | } 15 | }); 16 | 17 | wss.on('connection', function(ws) { 18 | ws.on('message', function(msg) { 19 | pub.publish('global', msg); 20 | }); 21 | }); -------------------------------------------------------------------------------- /src/v4/haproxy.cfg: -------------------------------------------------------------------------------- 1 | frontend all 2 | bind 0.0.0.0:8000 3 | default_backend sockets 4 | 5 | backend sockets 6 | balance leastconn 7 | server srv1 127.0.0.1:2000 check 8 | server srv2 127.0.0.1:2001 check -------------------------------------------------------------------------------- /src/v4/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Horizontally Scaling Node.js & Websockets Demo 7 | 8 | 9 | 10 | 11 |
12 |
Click or touch window to play.
13 |
14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/v4/node_modules/double-ended-queue/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules/* 2 | todo.txt 3 | npm-debug.log 4 | test/* 5 | benchmark/* 6 | browser/* 7 | src/* 8 | async 9 | sync 10 | mixed 11 | bench.json 12 | js/browser 13 | js/browser/* 14 | js/debug 15 | js/debug/* 16 | reader.js 17 | read.txt 18 | bench 19 | .editorconfig 20 | .jshintrc 21 | ast_passes.js 22 | mocharun.js 23 | throwaway.js 24 | throwaway.html 25 | deque.sublime-workspace 26 | deque.sublime-project 27 | changelog.js 28 | .travis.yml 29 | sauce_connect.log 30 | nodex64.exe 31 | bump.js 32 | -------------------------------------------------------------------------------- /src/v4/node_modules/double-ended-queue/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Petka Antonov 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions:

9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /src/v4/node_modules/options/.npmignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | node_modules 3 | .*.swp 4 | .lock-* 5 | build/ 6 | 7 | test 8 | -------------------------------------------------------------------------------- /src/v4/node_modules/options/Makefile: -------------------------------------------------------------------------------- 1 | ALL_TESTS = $(shell find test/ -name '*.test.js') 2 | 3 | run-tests: 4 | @./node_modules/.bin/mocha \ 5 | -t 2000 \ 6 | $(TESTFLAGS) \ 7 | $(TESTS) 8 | 9 | test: 10 | @$(MAKE) NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests 11 | 12 | .PHONY: test 13 | -------------------------------------------------------------------------------- /src/v4/node_modules/options/README.md: -------------------------------------------------------------------------------- 1 | # options.js # 2 | 3 | A very light-weight in-code option parsers for node.js. 4 | 5 | ## Usage ## 6 | 7 | ``` js 8 | var Options = require("options"); 9 | 10 | // Create an Options object 11 | function foo(options) { 12 | var default_options = { 13 | foo : "bar" 14 | }; 15 | 16 | // Create an option object with default value 17 | var opts = new Options(default_options); 18 | 19 | // Merge options 20 | opts = opts.merge(options); 21 | 22 | // Reset to default value 23 | opts.reset(); 24 | 25 | // Copy selected attributes out 26 | var seled_att = opts.copy("foo"); 27 | 28 | // Read json options from a file. 29 | opts.read("options.file"); // Sync 30 | opts.read("options.file", function(err){ // Async 31 | if(err){ // If error occurs 32 | console.log("File error."); 33 | }else{ 34 | // No error 35 | } 36 | }); 37 | 38 | // Attributes defined or not 39 | opts.isDefinedAndNonNull("foobar"); 40 | opts.isDefined("foobar"); 41 | } 42 | 43 | ``` 44 | 45 | 46 | ## License ## 47 | 48 | (The MIT License) 49 | 50 | Copyright (c) 2012 Einar Otto Stangvik <einaros@gmail.com> 51 | 52 | Permission is hereby granted, free of charge, to any person obtaining 53 | a copy of this software and associated documentation files (the 54 | 'Software'), to deal in the Software without restriction, including 55 | without limitation the rights to use, copy, modify, merge, publish, 56 | distribute, sublicense, and/or sell copies of the Software, and to 57 | permit persons to whom the Software is furnished to do so, subject to 58 | the following conditions: 59 | 60 | The above copyright notice and this permission notice shall be 61 | included in all copies or substantial portions of the Software. 62 | 63 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 64 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 65 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 66 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 67 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 68 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 69 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 70 | -------------------------------------------------------------------------------- /src/v4/node_modules/redis-commands/.npmignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | *.rdb 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # Compiled binary addons (http://nodejs.org/api/addons.html) 21 | build/Release 22 | 23 | # Dependency directory 24 | # Commenting this out is preferred by some people, see 25 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- 26 | node_modules 27 | 28 | # Users Environment Variables 29 | .lock-wscript 30 | -------------------------------------------------------------------------------- /src/v4/node_modules/redis-commands/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | sudo: false 3 | node_js: 4 | - "0.10" 5 | - "0.12" 6 | - "4" 7 | - "5" 8 | after_success: 9 | - CODECLIMATE_REPO_TOKEN=b57723fafcf0516f275d6b380cd506fd082ea88d86507eb82c8abd489b9b9a09 node ./node_modules/.bin/codeclimate-test-reporter < coverage/lcov.info 10 | -------------------------------------------------------------------------------- /src/v4/node_modules/redis-commands/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 NodeRedis 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/v4/node_modules/redis-commands/README.md: -------------------------------------------------------------------------------- 1 | # Redis Commands 2 | 3 | [![Build Status](https://travis-ci.org/NodeRedis/redis-commands.png?branch=master)](https://travis-ci.org/NodeRedis/redis-commands) 4 | [![Code Climate](https://codeclimate.com/github/NodeRedis/redis-commands/badges/gpa.svg)](https://codeclimate.com/github/NodeRedis/redis-commands) 5 | [![Test Coverage](https://codeclimate.com/github/NodeRedis/redis-commands/badges/coverage.svg)](https://codeclimate.com/github/NodeRedis/redis-commands/coverage) 6 | 7 | This module exports all the commands that Redis supports. 8 | 9 | ## Install 10 | 11 | ```shell 12 | $ npm install redis-commands 13 | ``` 14 | 15 | ## Usage 16 | 17 | ```javascript 18 | var commands = require('redis-commands'); 19 | ``` 20 | 21 | `.list` is an array contains all the lowercased commands: 22 | 23 | ```javascript 24 | commands.list.forEach(function (command) { 25 | console.log(command); 26 | }); 27 | ``` 28 | 29 | `.exists()` is used to check if the command exists: 30 | 31 | ```javascript 32 | commands.exists('set') // true 33 | commands.exists('other-command') // false 34 | ``` 35 | 36 | `.hasFlag()` is used to check if the command has the flag: 37 | 38 | ```javascript 39 | commands.hasFlag('set', 'readonly') // false 40 | ``` 41 | 42 | `.getKeyIndexes()` is used to get the indexes of keys in the command arguments: 43 | 44 | ```javascript 45 | commands.getKeyIndexes('set', ['key', 'value']) // [0] 46 | commands.getKeyIndexes('mget', ['key1', 'key2']) // [0, 1] 47 | ``` 48 | 49 | ## Acknowledgment 50 | 51 | Thank [@Yuan Chuan](https://github.com/yuanchuan) for the package name. The original redis-commands is renamed to [@yuanchuan/redis-commands](https://www.npmjs.com/package/@yuanchuan/redis-commands). 52 | -------------------------------------------------------------------------------- /src/v4/node_modules/redis-commands/changelog.md: -------------------------------------------------------------------------------- 1 | ## v.1.2.0 - 21 Apr, 2016 2 | 3 | Features 4 | 5 | - Added support for `MIGRATE [...] KEYS key1, key2` (Redis >= v.3.0.6) 6 | - Added build sanity check for unhandled commands with moveable keys 7 | - Rebuild the commands with the newest unstable release 8 | - Improved performance of .getKeyIndexes() 9 | 10 | Bugfix 11 | 12 | - Fixed command command returning the wrong arity due to a Redis bug 13 | - Fixed brpop command returning the wrong keystop due to a Redis bug 14 | 15 | ## v.1.1.0 - 09 Feb, 2016 16 | 17 | Features 18 | 19 | - Added .exists() to check for command existence 20 | - Improved performance of .hasFlag() 21 | -------------------------------------------------------------------------------- /src/v4/node_modules/redis-commands/tools/build.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var path = require('path'); 3 | var stringify = require('json-stable-stringify'); 4 | var commandPath = path.join(__dirname, '..', 'commands.json'); 5 | var redisCommands = require('../'); 6 | 7 | var Redis = require('ioredis'); 8 | var redis = new Redis(process.env.REDIS_URI); 9 | 10 | redis.command().then(function (res) { 11 | redis.disconnect(); 12 | 13 | // Find all special handled cases 14 | var movableKeys = String(redisCommands.getKeyIndexes).match(/case '[a-z-]+':/g).map(function (entry) { 15 | return entry.replace(/^case \'|\':$/g, ''); 16 | }); 17 | 18 | var commands = res.reduce(function (prev, current) { 19 | var currentCommandPos = movableKeys.indexOf(current[0]); 20 | if (currentCommandPos !== -1 && current[2].indexOf('movablekeys') !== -1) { 21 | movableKeys.splice(currentCommandPos, 1); 22 | } 23 | // https://github.com/antirez/redis/issues/2598 24 | if (current[0] === 'brpop' && current[4] === 1) { 25 | current[4] = -2; 26 | } 27 | prev[current[0]] = { 28 | arity: current[1] || 1, // https://github.com/antirez/redis/pull/2986 29 | flags: current[2], 30 | keyStart: current[3], 31 | keyStop: current[4], 32 | step: current[5] 33 | }; 34 | return prev; 35 | }, {}); 36 | 37 | // Future proof. Redis might implement this at some point 38 | // https://github.com/antirez/redis/pull/2982 39 | if (!commands.quit) { 40 | commands.quit = { 41 | arity: 1, 42 | flags: [ 43 | 'loading', 44 | 'stale', 45 | 'readonly' 46 | ], 47 | keyStart: 0, 48 | keyStop: 0, 49 | step: 0 50 | } 51 | } 52 | 53 | if (movableKeys.length !== 0) { 54 | throw new Error('Not all commands (\'' + movableKeys.join('\', \'') + '\') with the "movablekeys" flag are handled in the code'); 55 | } 56 | 57 | // Use json-stable-stringify instead fo JSON.stringify 58 | // for easier diffing 59 | var content = stringify(commands, { space: ' ' }); 60 | 61 | fs.writeFile(commandPath, content); 62 | }); 63 | -------------------------------------------------------------------------------- /src/v4/node_modules/redis-parser/.codeclimate.yml: -------------------------------------------------------------------------------- 1 | languages: 2 | JavaScript: true 3 | exclude_paths: 4 | - "benchmark/index.js" 5 | - "benchmark/old/javascript.js" 6 | - "test/parsers.spec.js" 7 | -------------------------------------------------------------------------------- /src/v4/node_modules/redis-parser/.npmignore: -------------------------------------------------------------------------------- 1 | # IntelliJ project files 2 | .idea 3 | *.iml 4 | out 5 | gen 6 | 7 | # Unrelevant files and folders 8 | benchmark 9 | coverage 10 | test 11 | .travis.yml 12 | .gitignore 13 | -------------------------------------------------------------------------------- /src/v4/node_modules/redis-parser/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 NodeRedis 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/v4/node_modules/redis-parser/changelog.md: -------------------------------------------------------------------------------- 1 | ## v.2.0.4 - 21 Jul, 2016 2 | 3 | Bugfixes 4 | 5 | - Fixed multi byte characters getting corrupted 6 | 7 | ## v.2.0.3 - 17 Jun, 2016 8 | 9 | Bugfixes 10 | 11 | - Fixed parser not working with huge buffers (e.g. 300 MB) 12 | 13 | ## v.2.0.2 - 08 Jun, 2016 14 | 15 | Bugfixes 16 | 17 | - Fixed parser with returnBuffers option returning corrupted data 18 | 19 | ## v.2.0.1 - 04 Jun, 2016 20 | 21 | Bugfixes 22 | 23 | - Fixed multiple parsers working concurrently resulting in faulty data in some cases 24 | 25 | ## v.2.0.0 - 29 May, 2016 26 | 27 | The javascript parser got completly rewritten by [Michael Diarmid](https://github.com/Salakar) and [Ruben Bridgewater](https://github.com/BridgeAR) and is now a lot faster than the hiredis parser. 28 | Therefore the hiredis parser was deprecated and should only be used for testing purposes and benchmarking comparison. 29 | 30 | All Errors returned by the parser are from now on of class ReplyError 31 | 32 | Features 33 | 34 | - Improved performance by up to 15x as fast as before 35 | - Improved options validation 36 | - Added ReplyError Class 37 | - Added parser benchmark 38 | - Switched default parser from hiredis to JS, no matter if hiredis is installed or not 39 | 40 | Removed 41 | 42 | - Deprecated hiredis support 43 | 44 | ## v.1.3.0 - 27 Mar, 2016 45 | 46 | Features 47 | 48 | - Added `auto` as parser name option to check what parser is available 49 | - Non existing requested parsers falls back into auto mode instead of always choosing the JS parser 50 | 51 | ## v.1.2.0 - 27 Mar, 2016 52 | 53 | Features 54 | 55 | - Added `stringNumbers` option to make sure all numbers are returned as string instead of a js number for precision 56 | - The parser is from now on going to print warnings if a parser is explicitly requested that does not exist and gracefully chooses the JS parser 57 | 58 | ## v.1.1.0 - 26 Jan, 2016 59 | 60 | Features 61 | 62 | - The parser is from now on going to reset itself on protocol errors 63 | -------------------------------------------------------------------------------- /src/v4/node_modules/redis-parser/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | module.exports = require('./lib/parser') 4 | module.exports.ReplyError = require('./lib/replyError') 5 | -------------------------------------------------------------------------------- /src/v4/node_modules/redis-parser/lib/hiredis.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | var hiredis = require('hiredis') 4 | var ReplyError = require('../lib/replyError') 5 | 6 | /** 7 | * Parse data 8 | * @param parser 9 | * @returns {*} 10 | */ 11 | function parseData (parser) { 12 | try { 13 | return parser.reader.get() 14 | } catch (err) { 15 | // Protocol errors land here 16 | // Reset the parser. Otherwise new commands can't be processed properly 17 | parser.reader = new hiredis.Reader(parser.options) 18 | parser.returnFatalError(new ReplyError(err.message)) 19 | } 20 | } 21 | 22 | /** 23 | * Hiredis Parser 24 | * @param options 25 | * @constructor 26 | */ 27 | function HiredisReplyParser (options) { 28 | this.returnError = options.returnError 29 | this.returnFatalError = options.returnFatalError || options.returnError 30 | this.returnReply = options.returnReply 31 | this.name = 'hiredis' 32 | this.options = { 33 | return_buffers: !!options.returnBuffers 34 | } 35 | this.reader = new hiredis.Reader(this.options) 36 | } 37 | 38 | HiredisReplyParser.prototype.execute = function (data) { 39 | this.reader.feed(data) 40 | var reply = parseData(this) 41 | 42 | while (reply !== undefined) { 43 | if (reply && reply.name === 'Error') { 44 | this.returnError(new ReplyError(reply.message)) 45 | } else { 46 | this.returnReply(reply) 47 | } 48 | reply = parseData(this) 49 | } 50 | } 51 | 52 | module.exports = HiredisReplyParser 53 | -------------------------------------------------------------------------------- /src/v4/node_modules/redis-parser/lib/replyError.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | var util = require('util') 4 | 5 | function ReplyError (message) { 6 | var limit = Error.stackTraceLimit 7 | Error.stackTraceLimit = 2 8 | Error.captureStackTrace(this, this.constructor) 9 | Error.stackTraceLimit = limit 10 | Object.defineProperty(this, 'message', { 11 | value: message || '', 12 | writable: true 13 | }) 14 | } 15 | 16 | util.inherits(ReplyError, Error) 17 | 18 | Object.defineProperty(ReplyError.prototype, 'name', { 19 | value: 'ReplyError', 20 | writable: true 21 | }) 22 | 23 | module.exports = ReplyError 24 | -------------------------------------------------------------------------------- /src/v4/node_modules/redis/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules/** 2 | coverage/** 3 | **.md 4 | **.log 5 | -------------------------------------------------------------------------------- /src/v4/node_modules/redis/.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | _Thanks for wanting to report an issue you've found in node_redis. Please delete 2 | this text and fill in the template below. Please note that the issue tracker is only 3 | for bug reports or feature requests. If you have a question, please ask that on [gitter]. 4 | If unsure about something, just do as best as you're able._ 5 | 6 | _Note that it will be much easier to fix the issue if a test case that reproduces 7 | the problem is provided. It is of course not always possible to reduce your code 8 | to a small test case, but it's highly appreciated to have as much data as possible. 9 | Thank you!_ 10 | 11 | * **Version**: What node_redis and what redis version is the issue happening on? 12 | * **Platform**: What platform / version? (For example Node.js 0.10 or Node.js 5.7.0 on Windows 7 / Ubuntu 15.10 / Azure) 13 | * **Description**: Description of your issue, stack traces from errors and code that reproduces the issue 14 | 15 | [gitter]: https://gitter.im/NodeRedis/node_redis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge -------------------------------------------------------------------------------- /src/v4/node_modules/redis/.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Pull Request check-list 2 | 3 | _Please make sure to review and check all of these items:_ 4 | 5 | - [ ] Does `npm test` pass with this change (including linting)? 6 | - [ ] Is the new or changed code fully tested? 7 | - [ ] Is a documentation update included (if this change modifies existing APIs, or introduces new ones)? 8 | 9 | _NOTE: these things are not required to open a PR and can be done 10 | afterwards / while the PR is open._ 11 | 12 | ### Description of change 13 | 14 | _Please provide a description of the change here._ -------------------------------------------------------------------------------- /src/v4/node_modules/redis/.npmignore: -------------------------------------------------------------------------------- 1 | examples/ 2 | benchmarks/ 3 | test/ 4 | .nyc_output/ 5 | coverage/ 6 | .tern-port 7 | *.log 8 | *.rdb 9 | *.out 10 | *.yml 11 | -------------------------------------------------------------------------------- /src/v4/node_modules/redis/LICENSE: -------------------------------------------------------------------------------- 1 | LICENSE - "MIT License" 2 | 3 | Copyright (c) 2016 by NodeRedis 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the "Software"), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /src/v4/node_modules/redis/lib/command.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var betterStackTraces = /development/i.test(process.env.NODE_ENV) || /\bredis\b/i.test(process.env.NODE_DEBUG); 4 | 5 | function Command (command, args, callback, call_on_write) { 6 | this.command = command; 7 | this.args = args; 8 | this.buffer_args = false; 9 | this.callback = callback; 10 | this.call_on_write = call_on_write; 11 | if (betterStackTraces) { 12 | this.error = new Error(); 13 | } 14 | } 15 | 16 | module.exports = Command; 17 | -------------------------------------------------------------------------------- /src/v4/node_modules/redis/lib/customErrors.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var util = require('util'); 4 | 5 | function AbortError (obj) { 6 | Error.captureStackTrace(this, this.constructor); 7 | Object.defineProperty(this, 'message', { 8 | value: obj.message || '', 9 | configurable: true, 10 | writable: true 11 | }); 12 | for (var keys = Object.keys(obj), key = keys.pop(); key; key = keys.pop()) { 13 | this[key] = obj[key]; 14 | } 15 | } 16 | 17 | function AggregateError (obj) { 18 | Error.captureStackTrace(this, this.constructor); 19 | Object.defineProperty(this, 'message', { 20 | value: obj.message || '', 21 | configurable: true, 22 | writable: true 23 | }); 24 | for (var keys = Object.keys(obj), key = keys.pop(); key; key = keys.pop()) { 25 | this[key] = obj[key]; 26 | } 27 | } 28 | 29 | util.inherits(AbortError, Error); 30 | util.inherits(AggregateError, AbortError); 31 | 32 | Object.defineProperty(AbortError.prototype, 'name', { 33 | value: 'AbortError', 34 | // configurable: true, 35 | writable: true 36 | }); 37 | Object.defineProperty(AggregateError.prototype, 'name', { 38 | value: 'AggregateError', 39 | // configurable: true, 40 | writable: true 41 | }); 42 | 43 | module.exports = { 44 | AbortError: AbortError, 45 | AggregateError: AggregateError 46 | }; 47 | -------------------------------------------------------------------------------- /src/v4/node_modules/redis/lib/debug.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var index = require('../'); 4 | 5 | function debug () { 6 | if (index.debug_mode) { 7 | console.error.apply(null, arguments); 8 | } 9 | } 10 | 11 | module.exports = debug; 12 | -------------------------------------------------------------------------------- /src/v4/node_modules/submono/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Benji Kay 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/v4/node_modules/submono/README.md: -------------------------------------------------------------------------------- 1 | # submono 2 | A Web Audio subtractive, monophonic synthesizer. Looking for polyphony? Check out [subpoly](https://github.com/okaybenji/subpoly)! 3 | 4 | ### Create a synth. 5 | ``` 6 | var audioCtx = new AudioContext(); 7 | var synth = new Monosynth(audioCtx); 8 | ``` 9 | 10 | ### Play a note. 11 | `synth.start();` 12 | 13 | ### Stop playing. 14 | `synth.stop();` 15 | 16 | ### Use methods to access pitch and waveform... 17 | ``` 18 | synth.pitch(440); // in hertz 19 | console.log(synth.waveform()); // 'sawtooth' (or sine, triangle, square) 20 | ``` 21 | 22 | ### ...get or set any other properties directly. 23 | ``` 24 | synth.maxGain = 0.5; // out of 1 25 | synth.attack = 1.0; // in seconds 26 | ``` 27 | 28 | ### Configure any or all the properties on initialization. 29 | ``` 30 | var config = { 31 | waveform: 'sawtooth', // or sine, triangle, square 32 | pitch: 440, // in hertz 33 | maxGain: 0.5, // out of 1 34 | attack: 0.1, // in seconds 35 | decay: 0.0, // in seconds 36 | sustain: 1.0, // out of 1 37 | release: 0.8, // in seconds 38 | cutoff: { 39 | maxFrequency: 7500, // in hertz 40 | attack: 0.1, // in seconds 41 | decay: 2.5, // in seconds 42 | sustain: 0.2 // 0-5; maxFrequency multiplied by this 43 | } 44 | }; 45 | 46 | var synth = new Monosynth(audioCtx, config); 47 | ``` 48 | 49 | ### Demo 50 | [Tiles: a musical, multiplayer web toy](http://okaybenji.github.io/tiles-client/) 51 | -------------------------------------------------------------------------------- /src/v4/node_modules/ultron/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | .tern-port 4 | -------------------------------------------------------------------------------- /src/v4/node_modules/ultron/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - "0.12" 5 | - "0.10" 6 | - "0.8" 7 | - "iojs" 8 | before_install: 9 | - 'if [ "${TRAVIS_NODE_VERSION}" == "0.8" ]; then npm install -g npm@2.11.1; fi' 10 | script: 11 | - "npm run test-travis" 12 | after_script: 13 | - "npm install coveralls@2.11.x && cat coverage/lcov.info | coveralls" 14 | matrix: 15 | fast_finish: true 16 | notifications: 17 | irc: 18 | channels: 19 | - "irc.freenode.org#unshift" 20 | on_success: change 21 | on_failure: change 22 | -------------------------------------------------------------------------------- /src/v4/node_modules/ultron/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Unshift.io, Arnout Kazemier, the Contributors. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/v4/node_modules/ws/.npmignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | node_modules 3 | .*.swp 4 | .lock-* 5 | build 6 | 7 | bench 8 | doc 9 | examples 10 | test 11 | 12 | -------------------------------------------------------------------------------- /src/v4/node_modules/ws/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | sudo: false 3 | node_js: 4 | - "5" 5 | - "4" 6 | - "0.12" 7 | addons: 8 | apt: 9 | sources: 10 | - ubuntu-toolchain-r-test 11 | packages: 12 | - gcc-4.9 13 | - g++-4.9 14 | before_install: 15 | - export CC="gcc-4.9" CXX="g++-4.9" 16 | -------------------------------------------------------------------------------- /src/v4/node_modules/ws/Makefile: -------------------------------------------------------------------------------- 1 | ALL_TESTS = $(shell find test/ -name '*.test.js') 2 | ALL_INTEGRATION = $(shell find test/ -name '*.integration.js') 3 | 4 | run-tests: 5 | @./node_modules/.bin/mocha \ 6 | -t 5000 \ 7 | -s 2400 \ 8 | $(TESTFLAGS) \ 9 | $(TESTS) 10 | 11 | run-integrationtests: 12 | @./node_modules/.bin/mocha \ 13 | -t 5000 \ 14 | -s 6000 \ 15 | $(TESTFLAGS) \ 16 | $(TESTS) 17 | 18 | run-coverage: 19 | @./node_modules/.bin/istanbul cover --report html \ 20 | ./node_modules/.bin/_mocha -- \ 21 | -t 5000 \ 22 | -s 6000 \ 23 | $(TESTFLAGS) \ 24 | $(TESTS) 25 | 26 | test: 27 | @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests 28 | 29 | integrationtest: 30 | @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_INTEGRATION)" run-integrationtests 31 | 32 | coverage: 33 | @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_TESTS)" run-coverage 34 | 35 | benchmark: 36 | @node bench/sender.benchmark.js 37 | @node bench/parser.benchmark.js 38 | 39 | autobahn: 40 | @NODE_PATH=lib node test/autobahn.js 41 | 42 | autobahn-server: 43 | @NODE_PATH=lib node test/autobahn-server.js 44 | 45 | .PHONY: test coverage 46 | -------------------------------------------------------------------------------- /src/v4/node_modules/ws/SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Guidelines 2 | 3 | Please contact us directly at **security@3rd-Eden.com** for any bug that might 4 | impact the security of this project. Please prefix the subject of your email 5 | with `[security]` in lowercase and square brackets. Our email filters will 6 | automatically prevent these messages from being moved to our spam box. 7 | 8 | You will receive an acknowledgement of your report within **24 hours**. 9 | 10 | All emails that do not include security vulnerabilities will be removed and 11 | blocked instantly. 12 | 13 | ## Exceptions 14 | 15 | If you do not receive an acknowledgement within the said time frame please give 16 | us the benefit of the doubt as it's possible that we haven't seen it yet. In 17 | this case please send us a message **without details** using one of the 18 | following methods: 19 | 20 | - Contact the lead developers of this project on their personal e-mails. You 21 | can find the e-mails in the git logs, for example using the following command: 22 | `git --no-pager show -s --format='%an <%ae>' ` where `` is the 23 | SHA1 of their latest commit in the project. 24 | - Create a GitHub issue stating contact details and the severity of the issue. 25 | 26 | Once we have acknowledged receipt of your report and confirmed the bug 27 | ourselves we will work with you to fix the vulnerability and publicly acknowledge 28 | your responsible disclosure, if you wish. In addition to that we will report 29 | all vulnerabilities to the [Node Security Project](https://nodesecurity.io/). 30 | 31 | ## History 32 | 33 | 04 Jan 2016: [Buffer vulnerablity](https://github.com/websockets/ws/releases/tag/1.0.1) 34 | -------------------------------------------------------------------------------- /src/v4/node_modules/ws/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /*! 4 | * ws: a node.js websocket client 5 | * Copyright(c) 2011 Einar Otto Stangvik 6 | * MIT Licensed 7 | */ 8 | 9 | var WS = module.exports = require('./lib/WebSocket'); 10 | 11 | WS.Server = require('./lib/WebSocketServer'); 12 | WS.Sender = require('./lib/Sender'); 13 | WS.Receiver = require('./lib/Receiver'); 14 | 15 | /** 16 | * Create a new WebSocket server. 17 | * 18 | * @param {Object} options Server options 19 | * @param {Function} fn Optional connection listener. 20 | * @returns {WS.Server} 21 | * @api public 22 | */ 23 | WS.createServer = function createServer(options, fn) { 24 | var server = new WS.Server(options); 25 | 26 | if (typeof fn === 'function') { 27 | server.on('connection', fn); 28 | } 29 | 30 | return server; 31 | }; 32 | 33 | /** 34 | * Create a new WebSocket connection. 35 | * 36 | * @param {String} address The URL/address we need to connect to. 37 | * @param {Function} fn Open listener. 38 | * @returns {WS} 39 | * @api public 40 | */ 41 | WS.connect = WS.createConnection = function connect(address, fn) { 42 | var client = new WS(address); 43 | 44 | if (typeof fn === 'function') { 45 | client.on('open', fn); 46 | } 47 | 48 | return client; 49 | }; 50 | -------------------------------------------------------------------------------- /src/v4/node_modules/ws/lib/BufferPool.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | var util = require('util'); 8 | 9 | function BufferPool(initialSize, growStrategy, shrinkStrategy) { 10 | if (this instanceof BufferPool === false) { 11 | throw new TypeError("Classes can't be function-called"); 12 | } 13 | 14 | if (typeof initialSize === 'function') { 15 | shrinkStrategy = growStrategy; 16 | growStrategy = initialSize; 17 | initialSize = 0; 18 | } 19 | else if (typeof initialSize === 'undefined') { 20 | initialSize = 0; 21 | } 22 | this._growStrategy = (growStrategy || function(db, size) { 23 | return db.used + size; 24 | }).bind(null, this); 25 | this._shrinkStrategy = (shrinkStrategy || function(db) { 26 | return initialSize; 27 | }).bind(null, this); 28 | this._buffer = initialSize ? new Buffer(initialSize) : null; 29 | this._offset = 0; 30 | this._used = 0; 31 | this._changeFactor = 0; 32 | this.__defineGetter__('size', function(){ 33 | return this._buffer == null ? 0 : this._buffer.length; 34 | }); 35 | this.__defineGetter__('used', function(){ 36 | return this._used; 37 | }); 38 | } 39 | 40 | BufferPool.prototype.get = function(length) { 41 | if (this._buffer == null || this._offset + length > this._buffer.length) { 42 | var newBuf = new Buffer(this._growStrategy(length)); 43 | this._buffer = newBuf; 44 | this._offset = 0; 45 | } 46 | this._used += length; 47 | var buf = this._buffer.slice(this._offset, this._offset + length); 48 | this._offset += length; 49 | return buf; 50 | } 51 | 52 | BufferPool.prototype.reset = function(forceNewBuffer) { 53 | var len = this._shrinkStrategy(); 54 | if (len < this.size) this._changeFactor -= 1; 55 | if (forceNewBuffer || this._changeFactor < -2) { 56 | this._changeFactor = 0; 57 | this._buffer = len ? new Buffer(len) : null; 58 | } 59 | this._offset = 0; 60 | this._used = 0; 61 | } 62 | 63 | module.exports = BufferPool; 64 | -------------------------------------------------------------------------------- /src/v4/node_modules/ws/lib/BufferUtil.fallback.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | exports.BufferUtil = { 8 | merge: function(mergedBuffer, buffers) { 9 | var offset = 0; 10 | for (var i = 0, l = buffers.length; i < l; ++i) { 11 | var buf = buffers[i]; 12 | buf.copy(mergedBuffer, offset); 13 | offset += buf.length; 14 | } 15 | }, 16 | mask: function(source, mask, output, offset, length) { 17 | var maskNum = mask.readUInt32LE(0, true); 18 | var i = 0; 19 | for (; i < length - 3; i += 4) { 20 | var num = maskNum ^ source.readUInt32LE(i, true); 21 | if (num < 0) num = 4294967296 + num; 22 | output.writeUInt32LE(num, offset + i, true); 23 | } 24 | switch (length % 4) { 25 | case 3: output[offset + i + 2] = source[i + 2] ^ mask[2]; 26 | case 2: output[offset + i + 1] = source[i + 1] ^ mask[1]; 27 | case 1: output[offset + i] = source[i] ^ mask[0]; 28 | case 0:; 29 | } 30 | }, 31 | unmask: function(data, mask) { 32 | var maskNum = mask.readUInt32LE(0, true); 33 | var length = data.length; 34 | var i = 0; 35 | for (; i < length - 3; i += 4) { 36 | var num = maskNum ^ data.readUInt32LE(i, true); 37 | if (num < 0) num = 4294967296 + num; 38 | data.writeUInt32LE(num, i, true); 39 | } 40 | switch (length % 4) { 41 | case 3: data[i + 2] = data[i + 2] ^ mask[2]; 42 | case 2: data[i + 1] = data[i + 1] ^ mask[1]; 43 | case 1: data[i] = data[i] ^ mask[0]; 44 | case 0:; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/v4/node_modules/ws/lib/BufferUtil.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /*! 4 | * ws: a node.js websocket client 5 | * Copyright(c) 2011 Einar Otto Stangvik 6 | * MIT Licensed 7 | */ 8 | 9 | try { 10 | module.exports = require('bufferutil'); 11 | } catch (e) { 12 | module.exports = require('./BufferUtil.fallback'); 13 | } 14 | -------------------------------------------------------------------------------- /src/v4/node_modules/ws/lib/ErrorCodes.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | module.exports = { 8 | isValidErrorCode: function(code) { 9 | return (code >= 1000 && code <= 1011 && code != 1004 && code != 1005 && code != 1006) || 10 | (code >= 3000 && code <= 4999); 11 | }, 12 | 1000: 'normal', 13 | 1001: 'going away', 14 | 1002: 'protocol error', 15 | 1003: 'unsupported data', 16 | 1004: 'reserved', 17 | 1005: 'reserved for extensions', 18 | 1006: 'reserved for extensions', 19 | 1007: 'inconsistent or invalid data', 20 | 1008: 'policy violation', 21 | 1009: 'message too big', 22 | 1010: 'extension handshake missing', 23 | 1011: 'an unexpected condition prevented the request from being fulfilled', 24 | }; -------------------------------------------------------------------------------- /src/v4/node_modules/ws/lib/Extensions.js: -------------------------------------------------------------------------------- 1 | 2 | var util = require('util'); 3 | 4 | /** 5 | * Module exports. 6 | */ 7 | 8 | exports.parse = parse; 9 | exports.format = format; 10 | 11 | /** 12 | * Parse extensions header value 13 | */ 14 | 15 | function parse(value) { 16 | value = value || ''; 17 | 18 | var extensions = {}; 19 | 20 | value.split(',').forEach(function(v) { 21 | var params = v.split(';'); 22 | var token = params.shift().trim(); 23 | var paramsList = extensions[token] = extensions[token] || []; 24 | var parsedParams = {}; 25 | 26 | params.forEach(function(param) { 27 | var parts = param.trim().split('='); 28 | var key = parts[0]; 29 | var value = parts[1]; 30 | if (typeof value === 'undefined') { 31 | value = true; 32 | } else { 33 | // unquote value 34 | if (value[0] === '"') { 35 | value = value.slice(1); 36 | } 37 | if (value[value.length - 1] === '"') { 38 | value = value.slice(0, value.length - 1); 39 | } 40 | } 41 | (parsedParams[key] = parsedParams[key] || []).push(value); 42 | }); 43 | 44 | paramsList.push(parsedParams); 45 | }); 46 | 47 | return extensions; 48 | } 49 | 50 | /** 51 | * Format extensions header value 52 | */ 53 | 54 | function format(value) { 55 | return Object.keys(value).map(function(token) { 56 | var paramsList = value[token]; 57 | if (!util.isArray(paramsList)) { 58 | paramsList = [paramsList]; 59 | } 60 | return paramsList.map(function(params) { 61 | return [token].concat(Object.keys(params).map(function(k) { 62 | var p = params[k]; 63 | if (!util.isArray(p)) p = [p]; 64 | return p.map(function(v) { 65 | return v === true ? k : k + '=' + v; 66 | }).join('; '); 67 | })).join('; '); 68 | }).join(', '); 69 | }).join(', '); 70 | } 71 | -------------------------------------------------------------------------------- /src/v4/node_modules/ws/lib/Validation.fallback.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | exports.Validation = { 8 | isValidUTF8: function(buffer) { 9 | return true; 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /src/v4/node_modules/ws/lib/Validation.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /*! 4 | * ws: a node.js websocket client 5 | * Copyright(c) 2011 Einar Otto Stangvik 6 | * MIT Licensed 7 | */ 8 | 9 | try { 10 | module.exports = require('utf-8-validate'); 11 | } catch (e) { 12 | module.exports = require('./Validation.fallback'); 13 | } 14 | -------------------------------------------------------------------------------- /src/v4/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Horizontally-Scaling-Node.js-Websockets-Talk", 3 | "description": "Talk about horizontally scaling node.js and WebSockets given at Connect.Tech 2016 and Thunder Plains 2016.", 4 | "author": "James Simpson (http://goldfirestudios.com)", 5 | "repository": { 6 | "type": "git", 7 | "url": "git://github.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk.git" 8 | }, 9 | "dependencies": { 10 | "submono": "*", 11 | "ws": "*", 12 | "redis": "*" 13 | } 14 | } -------------------------------------------------------------------------------- /src/v4/server.js: -------------------------------------------------------------------------------- 1 | var port = parseInt(process.argv[2], 10); 2 | var WebSocketServer = require('ws').Server; 3 | var wss = new WebSocketServer({port: port}); 4 | var redis = require('redis'); 5 | var pub = redis.createClient(); 6 | var sub = redis.createClient(); 7 | var color = 'blue'; 8 | 9 | switch (port) { 10 | case 2001: 11 | color = 'red'; 12 | break; 13 | 14 | case 2002: 15 | color = 'green'; 16 | break; 17 | 18 | case 2003: 19 | color = 'purple'; 20 | break; 21 | } 22 | 23 | sub.subscribe('global'); 24 | sub.on('message', function(channel, msg) { 25 | if (channel === 'global') { 26 | wss.clients.forEach(function(client) { 27 | client.send(msg); 28 | }); 29 | } 30 | }); 31 | 32 | wss.on('connection', function(ws) { 33 | ws.on('message', function(msg) { 34 | msg = JSON.parse(msg); 35 | msg.color = color; 36 | pub.publish('global', JSON.stringify(msg)); 37 | }); 38 | }); -------------------------------------------------------------------------------- /src/v5/haproxy.cfg: -------------------------------------------------------------------------------- 1 | frontend all 2 | bind 0.0.0.0:8000 3 | default_backend sockets 4 | 5 | backend sockets 6 | balance leastconn 7 | server srv1 127.0.0.1:2000 check 8 | server srv2 127.0.0.1:2001 check -------------------------------------------------------------------------------- /src/v5/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Horizontally Scaling Node.js & Websockets Demo 7 | 8 | 9 | 10 | 11 |
12 |
Click or touch window to play.
13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/v5/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Horizontally-Scaling-Node.js-Websockets-Talk", 3 | "description": "Talk about horizontally scaling node.js and WebSockets given at Connect.Tech 2016 and Thunder Plains 2016.", 4 | "author": "James Simpson (http://goldfirestudios.com)", 5 | "repository": { 6 | "type": "git", 7 | "url": "git://github.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk.git" 8 | }, 9 | "dependencies": { 10 | "submono": "*", 11 | "ws": "*", 12 | "redis": "*", 13 | "primus": "*" 14 | } 15 | } -------------------------------------------------------------------------------- /src/v5/server.js: -------------------------------------------------------------------------------- 1 | var port = parseInt(process.argv[2], 10); 2 | var Primus = require('primus'); 3 | var primus = new Primus.createServer({port: port, transformer: 'websockets'}); 4 | var redis = require('redis'); 5 | var pub = redis.createClient(); 6 | var sub = redis.createClient(); 7 | var color = 'blue'; 8 | 9 | switch (port) { 10 | case 2001: 11 | color = 'red'; 12 | break; 13 | 14 | case 2002: 15 | color = 'green'; 16 | break; 17 | 18 | case 2003: 19 | color = 'purple'; 20 | break; 21 | } 22 | 23 | sub.subscribe('global'); 24 | sub.on('message', function(channel, msg) { 25 | if (channel === 'global') { 26 | primus.write(JSON.parse(msg)); 27 | } 28 | }); 29 | 30 | primus.on('connection', function(ws) { 31 | console.log('CONNECTED', port); 32 | ws.on('data', function(msg) { 33 | msg.color = color; 34 | pub.publish('global', JSON.stringify(msg)); 35 | }); 36 | }); -------------------------------------------------------------------------------- /talk/css/theme/README.md: -------------------------------------------------------------------------------- 1 | ## Dependencies 2 | 3 | Themes are written using Sass to keep things modular and reduce the need for repeated selectors across files. Make sure that you have the reveal.js development environment including the Grunt dependencies installed before proceding: https://github.com/hakimel/reveal.js#full-setup 4 | 5 | ## Creating a Theme 6 | 7 | To create your own theme, start by duplicating a ```.scss``` file in [/css/theme/source](https://github.com/hakimel/reveal.js/blob/master/css/theme/source). It will be automatically compiled by Grunt from Sass to CSS (see the [Gruntfile](https://github.com/hakimel/reveal.js/blob/master/Gruntfile.js)) when you run `grunt css-themes`. 8 | 9 | Each theme file does four things in the following order: 10 | 11 | 1. **Include [/css/theme/template/mixins.scss](https://github.com/hakimel/reveal.js/blob/master/css/theme/template/mixins.scss)** 12 | Shared utility functions. 13 | 14 | 2. **Include [/css/theme/template/settings.scss](https://github.com/hakimel/reveal.js/blob/master/css/theme/template/settings.scss)** 15 | Declares a set of custom variables that the template file (step 4) expects. Can be overridden in step 3. 16 | 17 | 3. **Override** 18 | This is where you override the default theme. Either by specifying variables (see [settings.scss](https://github.com/hakimel/reveal.js/blob/master/css/theme/template/settings.scss) for reference) or by adding any selectors and styles you please. 19 | 20 | 4. **Include [/css/theme/template/theme.scss](https://github.com/hakimel/reveal.js/blob/master/css/theme/template/theme.scss)** 21 | The template theme file which will generate final CSS output based on the currently defined variables. 22 | -------------------------------------------------------------------------------- /talk/css/theme/source/beige.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Beige theme for reveal.js. 3 | * 4 | * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se 5 | */ 6 | 7 | 8 | // Default mixins and settings ----------------- 9 | @import "../template/mixins"; 10 | @import "../template/settings"; 11 | // --------------------------------------------- 12 | 13 | 14 | 15 | // Include theme-specific fonts 16 | @import url(../../lib/font/league-gothic/league-gothic.css); 17 | @import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic); 18 | 19 | 20 | // Override theme settings (see ../template/settings.scss) 21 | $mainColor: #333; 22 | $headingColor: #333; 23 | $headingTextShadow: none; 24 | $backgroundColor: #f7f3de; 25 | $linkColor: #8b743d; 26 | $linkColorHover: lighten( $linkColor, 20% ); 27 | $selectionBackgroundColor: rgba(79, 64, 28, 0.99); 28 | $heading1TextShadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0,0,0,.1), 0 0 5px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.3), 0 3px 5px rgba(0,0,0,.2), 0 5px 10px rgba(0,0,0,.25), 0 20px 20px rgba(0,0,0,.15); 29 | 30 | // Background generator 31 | @mixin bodyBackground() { 32 | @include radial-gradient( rgba(247,242,211,1), rgba(255,255,255,1) ); 33 | } 34 | 35 | 36 | 37 | // Theme template ------------------------------ 38 | @import "../template/theme"; 39 | // --------------------------------------------- -------------------------------------------------------------------------------- /talk/css/theme/source/black.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Black theme for reveal.js. This is the opposite of the 'white' theme. 3 | * 4 | * By Hakim El Hattab, http://hakim.se 5 | */ 6 | 7 | 8 | // Default mixins and settings ----------------- 9 | @import "../template/mixins"; 10 | @import "../template/settings"; 11 | // --------------------------------------------- 12 | 13 | 14 | // Include theme-specific fonts 15 | @import url(../../lib/font/source-sans-pro/source-sans-pro.css); 16 | 17 | 18 | // Override theme settings (see ../template/settings.scss) 19 | $backgroundColor: #222; 20 | 21 | $mainColor: #fff; 22 | $headingColor: #fff; 23 | 24 | $mainFontSize: 38px; 25 | $mainFont: 'Source Sans Pro', Helvetica, sans-serif; 26 | $headingFont: 'Source Sans Pro', Helvetica, sans-serif; 27 | $headingTextShadow: none; 28 | $headingLetterSpacing: normal; 29 | $headingTextTransform: uppercase; 30 | $headingFontWeight: 600; 31 | $linkColor: #42affa; 32 | $linkColorHover: lighten( $linkColor, 15% ); 33 | $selectionBackgroundColor: lighten( $linkColor, 25% ); 34 | 35 | $heading1Size: 2.5em; 36 | $heading2Size: 1.6em; 37 | $heading3Size: 1.3em; 38 | $heading4Size: 1.0em; 39 | 40 | section.has-light-background { 41 | &, h1, h2, h3, h4, h5, h6 { 42 | color: #222; 43 | } 44 | } 45 | 46 | 47 | // Theme template ------------------------------ 48 | @import "../template/theme"; 49 | // --------------------------------------------- -------------------------------------------------------------------------------- /talk/css/theme/source/blood.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Blood theme for reveal.js 3 | * Author: Walther http://github.com/Walther 4 | * 5 | * Designed to be used with highlight.js theme 6 | * "monokai_sublime.css" available from 7 | * https://github.com/isagalaev/highlight.js/ 8 | * 9 | * For other themes, change $codeBackground accordingly. 10 | * 11 | */ 12 | 13 | // Default mixins and settings ----------------- 14 | @import "../template/mixins"; 15 | @import "../template/settings"; 16 | // --------------------------------------------- 17 | 18 | // Include theme-specific fonts 19 | 20 | @import url(https://fonts.googleapis.com/css?family=Ubuntu:300,700,300italic,700italic); 21 | 22 | // Colors used in the theme 23 | $blood: #a23; 24 | $coal: #222; 25 | $codeBackground: #23241f; 26 | 27 | $backgroundColor: $coal; 28 | 29 | // Main text 30 | $mainFont: Ubuntu, 'sans-serif'; 31 | $mainFontSize: 36px; 32 | $mainColor: #eee; 33 | 34 | // Headings 35 | $headingFont: Ubuntu, 'sans-serif'; 36 | $headingTextShadow: 2px 2px 2px $coal; 37 | 38 | // h1 shadow, borrowed humbly from 39 | // (c) Default theme by Hakim El Hattab 40 | $heading1TextShadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0,0,0,.1), 0 0 5px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.3), 0 3px 5px rgba(0,0,0,.2), 0 5px 10px rgba(0,0,0,.25), 0 20px 20px rgba(0,0,0,.15); 41 | 42 | // Links 43 | $linkColor: $blood; 44 | $linkColorHover: lighten( $linkColor, 20% ); 45 | 46 | // Text selection 47 | $selectionBackgroundColor: $blood; 48 | $selectionColor: #fff; 49 | 50 | 51 | // Theme template ------------------------------ 52 | @import "../template/theme"; 53 | // --------------------------------------------- 54 | 55 | // some overrides after theme template import 56 | 57 | .reveal p { 58 | font-weight: 300; 59 | text-shadow: 1px 1px $coal; 60 | } 61 | 62 | .reveal h1, 63 | .reveal h2, 64 | .reveal h3, 65 | .reveal h4, 66 | .reveal h5, 67 | .reveal h6 { 68 | font-weight: 700; 69 | } 70 | 71 | .reveal p code { 72 | background-color: $codeBackground; 73 | display: inline-block; 74 | border-radius: 7px; 75 | } 76 | 77 | .reveal small code { 78 | vertical-align: baseline; 79 | } -------------------------------------------------------------------------------- /talk/css/theme/source/league.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * League theme for reveal.js. 3 | * 4 | * This was the default theme pre-3.0.0. 5 | * 6 | * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se 7 | */ 8 | 9 | 10 | // Default mixins and settings ----------------- 11 | @import "../template/mixins"; 12 | @import "../template/settings"; 13 | // --------------------------------------------- 14 | 15 | 16 | 17 | // Include theme-specific fonts 18 | @import url(../../lib/font/league-gothic/league-gothic.css); 19 | @import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic); 20 | 21 | // Override theme settings (see ../template/settings.scss) 22 | $headingTextShadow: 0px 0px 6px rgba(0,0,0,0.2); 23 | $heading1TextShadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0,0,0,.1), 0 0 5px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.3), 0 3px 5px rgba(0,0,0,.2), 0 5px 10px rgba(0,0,0,.25), 0 20px 20px rgba(0,0,0,.15); 24 | 25 | // Background generator 26 | @mixin bodyBackground() { 27 | @include radial-gradient( rgba(28,30,32,1), rgba(85,90,95,1) ); 28 | } 29 | 30 | 31 | 32 | // Theme template ------------------------------ 33 | @import "../template/theme"; 34 | // --------------------------------------------- -------------------------------------------------------------------------------- /talk/css/theme/source/moon.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Solarized Dark theme for reveal.js. 3 | * Author: Achim Staebler 4 | */ 5 | 6 | 7 | // Default mixins and settings ----------------- 8 | @import "../template/mixins"; 9 | @import "../template/settings"; 10 | // --------------------------------------------- 11 | 12 | 13 | 14 | // Include theme-specific fonts 15 | @import url(../../lib/font/league-gothic/league-gothic.css); 16 | @import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic); 17 | 18 | /** 19 | * Solarized colors by Ethan Schoonover 20 | */ 21 | html * { 22 | color-profile: sRGB; 23 | rendering-intent: auto; 24 | } 25 | 26 | // Solarized colors 27 | $base03: #002b36; 28 | $base02: #073642; 29 | $base01: #586e75; 30 | $base00: #657b83; 31 | $base0: #839496; 32 | $base1: #93a1a1; 33 | $base2: #eee8d5; 34 | $base3: #fdf6e3; 35 | $yellow: #b58900; 36 | $orange: #cb4b16; 37 | $red: #dc322f; 38 | $magenta: #d33682; 39 | $violet: #6c71c4; 40 | $blue: #268bd2; 41 | $cyan: #2aa198; 42 | $green: #859900; 43 | 44 | // Override theme settings (see ../template/settings.scss) 45 | $mainColor: $base1; 46 | $headingColor: $base2; 47 | $headingTextShadow: none; 48 | $backgroundColor: $base03; 49 | $linkColor: $blue; 50 | $linkColorHover: lighten( $linkColor, 20% ); 51 | $selectionBackgroundColor: $magenta; 52 | 53 | 54 | 55 | // Theme template ------------------------------ 56 | @import "../template/theme"; 57 | // --------------------------------------------- 58 | -------------------------------------------------------------------------------- /talk/css/theme/source/night.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Black theme for reveal.js. 3 | * 4 | * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se 5 | */ 6 | 7 | 8 | // Default mixins and settings ----------------- 9 | @import "../template/mixins"; 10 | @import "../template/settings"; 11 | // --------------------------------------------- 12 | 13 | 14 | // Include theme-specific fonts 15 | @import url(https://fonts.googleapis.com/css?family=Montserrat:700); 16 | @import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic,700italic); 17 | 18 | 19 | // Override theme settings (see ../template/settings.scss) 20 | $backgroundColor: #111; 21 | 22 | $mainFont: 'Open Sans', sans-serif; 23 | $linkColor: #e7ad52; 24 | $linkColorHover: lighten( $linkColor, 20% ); 25 | $headingFont: 'Montserrat', Impact, sans-serif; 26 | $headingTextShadow: none; 27 | $headingLetterSpacing: -0.03em; 28 | $headingTextTransform: none; 29 | $selectionBackgroundColor: #e7ad52; 30 | $mainFontSize: 30px; 31 | 32 | 33 | // Theme template ------------------------------ 34 | @import "../template/theme"; 35 | // --------------------------------------------- -------------------------------------------------------------------------------- /talk/css/theme/source/serif.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * A simple theme for reveal.js presentations, similar 3 | * to the default theme. The accent color is brown. 4 | * 5 | * This theme is Copyright (C) 2012-2013 Owen Versteeg, http://owenversteeg.com - it is MIT licensed. 6 | */ 7 | 8 | 9 | // Default mixins and settings ----------------- 10 | @import "../template/mixins"; 11 | @import "../template/settings"; 12 | // --------------------------------------------- 13 | 14 | 15 | 16 | // Override theme settings (see ../template/settings.scss) 17 | $mainFont: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; 18 | $mainColor: #000; 19 | $headingFont: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; 20 | $headingColor: #383D3D; 21 | $headingTextShadow: none; 22 | $headingTextTransform: none; 23 | $backgroundColor: #F0F1EB; 24 | $linkColor: #51483D; 25 | $linkColorHover: lighten( $linkColor, 20% ); 26 | $selectionBackgroundColor: #26351C; 27 | 28 | .reveal a { 29 | line-height: 1.3em; 30 | } 31 | 32 | 33 | // Theme template ------------------------------ 34 | @import "../template/theme"; 35 | // --------------------------------------------- 36 | -------------------------------------------------------------------------------- /talk/css/theme/source/simple.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * A simple theme for reveal.js presentations, similar 3 | * to the default theme. The accent color is darkblue. 4 | * 5 | * This theme is Copyright (C) 2012 Owen Versteeg, https://github.com/StereotypicalApps. It is MIT licensed. 6 | * reveal.js is Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se 7 | */ 8 | 9 | 10 | // Default mixins and settings ----------------- 11 | @import "../template/mixins"; 12 | @import "../template/settings"; 13 | // --------------------------------------------- 14 | 15 | 16 | 17 | // Include theme-specific fonts 18 | @import url(https://fonts.googleapis.com/css?family=News+Cycle:400,700); 19 | @import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic); 20 | 21 | 22 | // Override theme settings (see ../template/settings.scss) 23 | $mainFont: 'Lato', sans-serif; 24 | $mainColor: #000; 25 | $headingFont: 'News Cycle', Impact, sans-serif; 26 | $headingColor: #000; 27 | $headingTextShadow: none; 28 | $headingTextTransform: none; 29 | $backgroundColor: #fff; 30 | $linkColor: #00008B; 31 | $linkColorHover: lighten( $linkColor, 20% ); 32 | $selectionBackgroundColor: rgba(0, 0, 0, 0.99); 33 | 34 | 35 | 36 | // Theme template ------------------------------ 37 | @import "../template/theme"; 38 | // --------------------------------------------- -------------------------------------------------------------------------------- /talk/css/theme/source/sky.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Sky theme for reveal.js. 3 | * 4 | * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se 5 | */ 6 | 7 | 8 | // Default mixins and settings ----------------- 9 | @import "../template/mixins"; 10 | @import "../template/settings"; 11 | // --------------------------------------------- 12 | 13 | 14 | 15 | // Include theme-specific fonts 16 | @import url(https://fonts.googleapis.com/css?family=Quicksand:400,700,400italic,700italic); 17 | @import url(https://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700); 18 | 19 | 20 | // Override theme settings (see ../template/settings.scss) 21 | $mainFont: 'Open Sans', sans-serif; 22 | $mainColor: #333; 23 | $headingFont: 'Quicksand', sans-serif; 24 | $headingColor: #333; 25 | $headingLetterSpacing: -0.08em; 26 | $headingTextShadow: none; 27 | $backgroundColor: #f7fbfc; 28 | $linkColor: #3b759e; 29 | $linkColorHover: lighten( $linkColor, 20% ); 30 | $selectionBackgroundColor: #134674; 31 | 32 | // Fix links so they are not cut off 33 | .reveal a { 34 | line-height: 1.3em; 35 | } 36 | 37 | // Background generator 38 | @mixin bodyBackground() { 39 | @include radial-gradient( #add9e4, #f7fbfc ); 40 | } 41 | 42 | 43 | 44 | // Theme template ------------------------------ 45 | @import "../template/theme"; 46 | // --------------------------------------------- 47 | -------------------------------------------------------------------------------- /talk/css/theme/source/solarized.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Solarized Light theme for reveal.js. 3 | * Author: Achim Staebler 4 | */ 5 | 6 | 7 | // Default mixins and settings ----------------- 8 | @import "../template/mixins"; 9 | @import "../template/settings"; 10 | // --------------------------------------------- 11 | 12 | 13 | 14 | // Include theme-specific fonts 15 | @import url(../../lib/font/league-gothic/league-gothic.css); 16 | @import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic); 17 | 18 | 19 | /** 20 | * Solarized colors by Ethan Schoonover 21 | */ 22 | html * { 23 | color-profile: sRGB; 24 | rendering-intent: auto; 25 | } 26 | 27 | // Solarized colors 28 | $base03: #002b36; 29 | $base02: #073642; 30 | $base01: #586e75; 31 | $base00: #657b83; 32 | $base0: #839496; 33 | $base1: #93a1a1; 34 | $base2: #eee8d5; 35 | $base3: #fdf6e3; 36 | $yellow: #b58900; 37 | $orange: #cb4b16; 38 | $red: #dc322f; 39 | $magenta: #d33682; 40 | $violet: #6c71c4; 41 | $blue: #268bd2; 42 | $cyan: #2aa198; 43 | $green: #859900; 44 | 45 | // Override theme settings (see ../template/settings.scss) 46 | $mainColor: $base00; 47 | $headingColor: $base01; 48 | $headingTextShadow: none; 49 | $backgroundColor: $base3; 50 | $linkColor: $blue; 51 | $linkColorHover: lighten( $linkColor, 20% ); 52 | $selectionBackgroundColor: $magenta; 53 | 54 | // Background generator 55 | // @mixin bodyBackground() { 56 | // @include radial-gradient( rgba($base3,1), rgba(lighten($base3, 20%),1) ); 57 | // } 58 | 59 | 60 | 61 | // Theme template ------------------------------ 62 | @import "../template/theme"; 63 | // --------------------------------------------- 64 | -------------------------------------------------------------------------------- /talk/css/theme/source/white.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * White theme for reveal.js. This is the opposite of the 'black' theme. 3 | * 4 | * By Hakim El Hattab, http://hakim.se 5 | */ 6 | 7 | 8 | // Default mixins and settings ----------------- 9 | @import "../template/mixins"; 10 | @import "../template/settings"; 11 | // --------------------------------------------- 12 | 13 | 14 | // Include theme-specific fonts 15 | @import url(../../lib/font/source-sans-pro/source-sans-pro.css); 16 | 17 | 18 | // Override theme settings (see ../template/settings.scss) 19 | $backgroundColor: #fff; 20 | 21 | $mainColor: #222; 22 | $headingColor: #222; 23 | 24 | $mainFontSize: 38px; 25 | $mainFont: 'Source Sans Pro', Helvetica, sans-serif; 26 | $headingFont: 'Source Sans Pro', Helvetica, sans-serif; 27 | $headingTextShadow: none; 28 | $headingLetterSpacing: normal; 29 | $headingTextTransform: uppercase; 30 | $headingFontWeight: 600; 31 | $linkColor: #2a76dd; 32 | $linkColorHover: lighten( $linkColor, 15% ); 33 | $selectionBackgroundColor: lighten( $linkColor, 25% ); 34 | 35 | $heading1Size: 2.5em; 36 | $heading2Size: 1.6em; 37 | $heading3Size: 1.3em; 38 | $heading4Size: 1.0em; 39 | 40 | section.has-dark-background { 41 | &, h1, h2, h3, h4, h5, h6 { 42 | color: #fff; 43 | } 44 | } 45 | 46 | 47 | // Theme template ------------------------------ 48 | @import "../template/theme"; 49 | // --------------------------------------------- -------------------------------------------------------------------------------- /talk/css/theme/template/mixins.scss: -------------------------------------------------------------------------------- 1 | @mixin vertical-gradient( $top, $bottom ) { 2 | background: $top; 3 | background: -moz-linear-gradient( top, $top 0%, $bottom 100% ); 4 | background: -webkit-gradient( linear, left top, left bottom, color-stop(0%,$top), color-stop(100%,$bottom) ); 5 | background: -webkit-linear-gradient( top, $top 0%, $bottom 100% ); 6 | background: -o-linear-gradient( top, $top 0%, $bottom 100% ); 7 | background: -ms-linear-gradient( top, $top 0%, $bottom 100% ); 8 | background: linear-gradient( top, $top 0%, $bottom 100% ); 9 | } 10 | 11 | @mixin horizontal-gradient( $top, $bottom ) { 12 | background: $top; 13 | background: -moz-linear-gradient( left, $top 0%, $bottom 100% ); 14 | background: -webkit-gradient( linear, left top, right top, color-stop(0%,$top), color-stop(100%,$bottom) ); 15 | background: -webkit-linear-gradient( left, $top 0%, $bottom 100% ); 16 | background: -o-linear-gradient( left, $top 0%, $bottom 100% ); 17 | background: -ms-linear-gradient( left, $top 0%, $bottom 100% ); 18 | background: linear-gradient( left, $top 0%, $bottom 100% ); 19 | } 20 | 21 | @mixin radial-gradient( $outer, $inner, $type: circle ) { 22 | background: $outer; 23 | background: -moz-radial-gradient( center, $type cover, $inner 0%, $outer 100% ); 24 | background: -webkit-gradient( radial, center center, 0px, center center, 100%, color-stop(0%,$inner), color-stop(100%,$outer) ); 25 | background: -webkit-radial-gradient( center, $type cover, $inner 0%, $outer 100% ); 26 | background: -o-radial-gradient( center, $type cover, $inner 0%, $outer 100% ); 27 | background: -ms-radial-gradient( center, $type cover, $inner 0%, $outer 100% ); 28 | background: radial-gradient( center, $type cover, $inner 0%, $outer 100% ); 29 | } -------------------------------------------------------------------------------- /talk/css/theme/template/settings.scss: -------------------------------------------------------------------------------- 1 | // Base settings for all themes that can optionally be 2 | // overridden by the super-theme 3 | 4 | // Background of the presentation 5 | $backgroundColor: #2b2b2b; 6 | 7 | // Primary/body text 8 | $mainFont: 'Lato', sans-serif; 9 | $mainFontSize: 36px; 10 | $mainColor: #eee; 11 | 12 | // Vertical spacing between blocks of text 13 | $blockMargin: 20px; 14 | 15 | // Headings 16 | $headingMargin: 0 0 $blockMargin 0; 17 | $headingFont: 'League Gothic', Impact, sans-serif; 18 | $headingColor: #eee; 19 | $headingLineHeight: 1.2; 20 | $headingLetterSpacing: normal; 21 | $headingTextTransform: uppercase; 22 | $headingTextShadow: none; 23 | $headingFontWeight: normal; 24 | $heading1TextShadow: $headingTextShadow; 25 | 26 | $heading1Size: 3.77em; 27 | $heading2Size: 2.11em; 28 | $heading3Size: 1.55em; 29 | $heading4Size: 1.00em; 30 | 31 | // Links and actions 32 | $linkColor: #13DAEC; 33 | $linkColorHover: lighten( $linkColor, 20% ); 34 | 35 | // Text selection 36 | $selectionBackgroundColor: #FF5E99; 37 | $selectionColor: #fff; 38 | 39 | // Generates the presentation background, can be overridden 40 | // to return a background image or gradient 41 | @mixin bodyBackground() { 42 | background: $backgroundColor; 43 | } -------------------------------------------------------------------------------- /talk/images/github.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /talk/images/james.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk/7e09e7bb7ff0c82f01c17bee8955bfdf2aa95afe/talk/images/james.png -------------------------------------------------------------------------------- /talk/images/stack01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk/7e09e7bb7ff0c82f01c17bee8955bfdf2aa95afe/talk/images/stack01.png -------------------------------------------------------------------------------- /talk/images/stack02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk/7e09e7bb7ff0c82f01c17bee8955bfdf2aa95afe/talk/images/stack02.png -------------------------------------------------------------------------------- /talk/images/twitter.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /talk/lib/css/zenburn.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Zenburn style from voldmar.ru (c) Vladimir Epifanov 4 | based on dark.css by Ivan Sagalaev 5 | 6 | */ 7 | 8 | .hljs { 9 | display: block; 10 | overflow-x: auto; 11 | padding: 0.5em; 12 | background: #3f3f3f; 13 | color: #dcdcdc; 14 | } 15 | 16 | .hljs-keyword, 17 | .hljs-selector-tag, 18 | .hljs-tag { 19 | color: #e3ceab; 20 | } 21 | 22 | .hljs-template-tag { 23 | color: #dcdcdc; 24 | } 25 | 26 | .hljs-number { 27 | color: #8cd0d3; 28 | } 29 | 30 | .hljs-variable, 31 | .hljs-template-variable, 32 | .hljs-attribute { 33 | color: #efdcbc; 34 | } 35 | 36 | .hljs-literal { 37 | color: #efefaf; 38 | } 39 | 40 | .hljs-subst { 41 | color: #8f8f8f; 42 | } 43 | 44 | .hljs-title, 45 | .hljs-name, 46 | .hljs-selector-id, 47 | .hljs-selector-class, 48 | .hljs-section, 49 | .hljs-type { 50 | color: #efef8f; 51 | } 52 | 53 | .hljs-symbol, 54 | .hljs-bullet, 55 | .hljs-link { 56 | color: #dca3a3; 57 | } 58 | 59 | .hljs-deletion, 60 | .hljs-string, 61 | .hljs-built_in, 62 | .hljs-builtin-name { 63 | color: #cc9393; 64 | } 65 | 66 | .hljs-addition, 67 | .hljs-comment, 68 | .hljs-quote, 69 | .hljs-meta { 70 | color: #7f9f7f; 71 | } 72 | 73 | 74 | .hljs-emphasis { 75 | font-style: italic; 76 | } 77 | 78 | .hljs-strong { 79 | font-weight: bold; 80 | } 81 | -------------------------------------------------------------------------------- /talk/lib/font/league-gothic/LICENSE: -------------------------------------------------------------------------------- 1 | SIL Open Font License (OFL) 2 | http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL 3 | -------------------------------------------------------------------------------- /talk/lib/font/league-gothic/league-gothic.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'League Gothic'; 3 | src: url('league-gothic.eot'); 4 | src: url('league-gothic.eot?#iefix') format('embedded-opentype'), 5 | url('league-gothic.woff') format('woff'), 6 | url('league-gothic.ttf') format('truetype'); 7 | 8 | font-weight: normal; 9 | font-style: normal; 10 | } -------------------------------------------------------------------------------- /talk/lib/font/league-gothic/league-gothic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk/7e09e7bb7ff0c82f01c17bee8955bfdf2aa95afe/talk/lib/font/league-gothic/league-gothic.eot -------------------------------------------------------------------------------- /talk/lib/font/league-gothic/league-gothic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk/7e09e7bb7ff0c82f01c17bee8955bfdf2aa95afe/talk/lib/font/league-gothic/league-gothic.ttf -------------------------------------------------------------------------------- /talk/lib/font/league-gothic/league-gothic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk/7e09e7bb7ff0c82f01c17bee8955bfdf2aa95afe/talk/lib/font/league-gothic/league-gothic.woff -------------------------------------------------------------------------------- /talk/lib/font/source-sans-pro/source-sans-pro-italic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk/7e09e7bb7ff0c82f01c17bee8955bfdf2aa95afe/talk/lib/font/source-sans-pro/source-sans-pro-italic.eot -------------------------------------------------------------------------------- /talk/lib/font/source-sans-pro/source-sans-pro-italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk/7e09e7bb7ff0c82f01c17bee8955bfdf2aa95afe/talk/lib/font/source-sans-pro/source-sans-pro-italic.ttf -------------------------------------------------------------------------------- /talk/lib/font/source-sans-pro/source-sans-pro-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk/7e09e7bb7ff0c82f01c17bee8955bfdf2aa95afe/talk/lib/font/source-sans-pro/source-sans-pro-italic.woff -------------------------------------------------------------------------------- /talk/lib/font/source-sans-pro/source-sans-pro-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk/7e09e7bb7ff0c82f01c17bee8955bfdf2aa95afe/talk/lib/font/source-sans-pro/source-sans-pro-regular.eot -------------------------------------------------------------------------------- /talk/lib/font/source-sans-pro/source-sans-pro-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk/7e09e7bb7ff0c82f01c17bee8955bfdf2aa95afe/talk/lib/font/source-sans-pro/source-sans-pro-regular.ttf -------------------------------------------------------------------------------- /talk/lib/font/source-sans-pro/source-sans-pro-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk/7e09e7bb7ff0c82f01c17bee8955bfdf2aa95afe/talk/lib/font/source-sans-pro/source-sans-pro-regular.woff -------------------------------------------------------------------------------- /talk/lib/font/source-sans-pro/source-sans-pro-semibold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk/7e09e7bb7ff0c82f01c17bee8955bfdf2aa95afe/talk/lib/font/source-sans-pro/source-sans-pro-semibold.eot -------------------------------------------------------------------------------- /talk/lib/font/source-sans-pro/source-sans-pro-semibold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk/7e09e7bb7ff0c82f01c17bee8955bfdf2aa95afe/talk/lib/font/source-sans-pro/source-sans-pro-semibold.ttf -------------------------------------------------------------------------------- /talk/lib/font/source-sans-pro/source-sans-pro-semibold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk/7e09e7bb7ff0c82f01c17bee8955bfdf2aa95afe/talk/lib/font/source-sans-pro/source-sans-pro-semibold.woff -------------------------------------------------------------------------------- /talk/lib/font/source-sans-pro/source-sans-pro-semibolditalic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk/7e09e7bb7ff0c82f01c17bee8955bfdf2aa95afe/talk/lib/font/source-sans-pro/source-sans-pro-semibolditalic.eot -------------------------------------------------------------------------------- /talk/lib/font/source-sans-pro/source-sans-pro-semibolditalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk/7e09e7bb7ff0c82f01c17bee8955bfdf2aa95afe/talk/lib/font/source-sans-pro/source-sans-pro-semibolditalic.ttf -------------------------------------------------------------------------------- /talk/lib/font/source-sans-pro/source-sans-pro-semibolditalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goldfire/Horizontally-Scaling-Node.js-Websockets-Talk/7e09e7bb7ff0c82f01c17bee8955bfdf2aa95afe/talk/lib/font/source-sans-pro/source-sans-pro-semibolditalic.woff -------------------------------------------------------------------------------- /talk/lib/font/source-sans-pro/source-sans-pro.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Source Sans Pro'; 3 | src: url('source-sans-pro-regular.eot'); 4 | src: url('source-sans-pro-regular.eot?#iefix') format('embedded-opentype'), 5 | url('source-sans-pro-regular.woff') format('woff'), 6 | url('source-sans-pro-regular.ttf') format('truetype'); 7 | font-weight: normal; 8 | font-style: normal; 9 | } 10 | 11 | @font-face { 12 | font-family: 'Source Sans Pro'; 13 | src: url('source-sans-pro-italic.eot'); 14 | src: url('source-sans-pro-italic.eot?#iefix') format('embedded-opentype'), 15 | url('source-sans-pro-italic.woff') format('woff'), 16 | url('source-sans-pro-italic.ttf') format('truetype'); 17 | font-weight: normal; 18 | font-style: italic; 19 | } 20 | 21 | @font-face { 22 | font-family: 'Source Sans Pro'; 23 | src: url('source-sans-pro-semibold.eot'); 24 | src: url('source-sans-pro-semibold.eot?#iefix') format('embedded-opentype'), 25 | url('source-sans-pro-semibold.woff') format('woff'), 26 | url('source-sans-pro-semibold.ttf') format('truetype'); 27 | font-weight: 600; 28 | font-style: normal; 29 | } 30 | 31 | @font-face { 32 | font-family: 'Source Sans Pro'; 33 | src: url('source-sans-pro-semibolditalic.eot'); 34 | src: url('source-sans-pro-semibolditalic.eot?#iefix') format('embedded-opentype'), 35 | url('source-sans-pro-semibolditalic.woff') format('woff'), 36 | url('source-sans-pro-semibolditalic.ttf') format('truetype'); 37 | font-weight: 600; 38 | font-style: italic; 39 | } -------------------------------------------------------------------------------- /talk/lib/js/classList.js: -------------------------------------------------------------------------------- 1 | /*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js*/ 2 | if(typeof document!=="undefined"&&!("classList" in document.createElement("a"))){(function(j){var a="classList",f="prototype",m=(j.HTMLElement||j.Element)[f],b=Object,k=String[f].trim||function(){return this.replace(/^\s+|\s+$/g,"")},c=Array[f].indexOf||function(q){var p=0,o=this.length;for(;pbody{font-family: sans-serif;}

reveal.js multiplex server.

Generate token'); 38 | res.end(); 39 | }); 40 | stream.on('readable', function() { 41 | stream.pipe(res); 42 | }); 43 | }); 44 | 45 | app.get("/token", function(req,res) { 46 | var ts = new Date().getTime(); 47 | var rand = Math.floor(Math.random()*9999999); 48 | var secret = ts.toString() + rand.toString(); 49 | res.send({secret: secret, socketId: createHash(secret)}); 50 | }); 51 | 52 | var createHash = function(secret) { 53 | var cipher = crypto.createCipher('blowfish', secret); 54 | return(cipher.final('hex')); 55 | }; 56 | 57 | // Actually listen 58 | server.listen( opts.port || null ); 59 | 60 | var brown = '\033[33m', 61 | green = '\033[32m', 62 | reset = '\033[0m'; 63 | 64 | console.log( brown + "reveal.js:" + reset + " Multiplex running on port " + green + opts.port + reset ); -------------------------------------------------------------------------------- /talk/plugin/multiplex/master.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 3 | // Don't emit events from inside of notes windows 4 | if ( window.location.search.match( /receiver/gi ) ) { return; } 5 | 6 | var multiplex = Reveal.getConfig().multiplex; 7 | 8 | var socket = io.connect( multiplex.url ); 9 | 10 | function post() { 11 | 12 | var messageData = { 13 | state: Reveal.getState(), 14 | secret: multiplex.secret, 15 | socketId: multiplex.id 16 | }; 17 | 18 | socket.emit( 'multiplex-statechanged', messageData ); 19 | 20 | }; 21 | 22 | // Monitor events that trigger a change in state 23 | Reveal.addEventListener( 'slidechanged', post ); 24 | Reveal.addEventListener( 'fragmentshown', post ); 25 | Reveal.addEventListener( 'fragmenthidden', post ); 26 | Reveal.addEventListener( 'overviewhidden', post ); 27 | Reveal.addEventListener( 'overviewshown', post ); 28 | Reveal.addEventListener( 'paused', post ); 29 | Reveal.addEventListener( 'resumed', post ); 30 | 31 | }()); -------------------------------------------------------------------------------- /talk/plugin/multiplex/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "reveal-js-multiplex", 3 | "version": "1.0.0", 4 | "description": "reveal.js multiplex server", 5 | "homepage": "http://lab.hakim.se/reveal-js", 6 | "scripts": { 7 | "start": "node index.js" 8 | }, 9 | "engines": { 10 | "node": "~4.1.1" 11 | }, 12 | "dependencies": { 13 | "express": "~4.13.3", 14 | "grunt-cli": "~0.1.13", 15 | "mustache": "~2.2.1", 16 | "socket.io": "~1.3.7" 17 | }, 18 | "license": "MIT" 19 | } 20 | -------------------------------------------------------------------------------- /talk/plugin/notes-server/client.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 3 | // don't emit events from inside the previews themselves 4 | if( window.location.search.match( /receiver/gi ) ) { return; } 5 | 6 | var socket = io.connect( window.location.origin ), 7 | socketId = Math.random().toString().slice( 2 ); 8 | 9 | console.log( 'View slide notes at ' + window.location.origin + '/notes/' + socketId ); 10 | 11 | window.open( window.location.origin + '/notes/' + socketId, 'notes-' + socketId ); 12 | 13 | /** 14 | * Posts the current slide data to the notes window 15 | */ 16 | function post() { 17 | 18 | var slideElement = Reveal.getCurrentSlide(), 19 | notesElement = slideElement.querySelector( 'aside.notes' ); 20 | 21 | var messageData = { 22 | notes: '', 23 | markdown: false, 24 | socketId: socketId, 25 | state: Reveal.getState() 26 | }; 27 | 28 | // Look for notes defined in a slide attribute 29 | if( slideElement.hasAttribute( 'data-notes' ) ) { 30 | messageData.notes = slideElement.getAttribute( 'data-notes' ); 31 | } 32 | 33 | // Look for notes defined in an aside element 34 | if( notesElement ) { 35 | messageData.notes = notesElement.innerHTML; 36 | messageData.markdown = typeof notesElement.getAttribute( 'data-markdown' ) === 'string'; 37 | } 38 | 39 | socket.emit( 'statechanged', messageData ); 40 | 41 | } 42 | 43 | // When a new notes window connects, post our current state 44 | socket.on( 'new-subscriber', function( data ) { 45 | post(); 46 | } ); 47 | 48 | // When the state changes from inside of the speaker view 49 | socket.on( 'statechanged-speaker', function( data ) { 50 | Reveal.setState( data.state ); 51 | } ); 52 | 53 | // Monitor events that trigger a change in state 54 | Reveal.addEventListener( 'slidechanged', post ); 55 | Reveal.addEventListener( 'fragmentshown', post ); 56 | Reveal.addEventListener( 'fragmenthidden', post ); 57 | Reveal.addEventListener( 'overviewhidden', post ); 58 | Reveal.addEventListener( 'overviewshown', post ); 59 | Reveal.addEventListener( 'paused', post ); 60 | Reveal.addEventListener( 'resumed', post ); 61 | 62 | // Post the initial state 63 | post(); 64 | 65 | }()); 66 | -------------------------------------------------------------------------------- /talk/plugin/notes-server/index.js: -------------------------------------------------------------------------------- 1 | var http = require('http'); 2 | var express = require('express'); 3 | var fs = require('fs'); 4 | var io = require('socket.io'); 5 | var Mustache = require('mustache'); 6 | 7 | var app = express(); 8 | var staticDir = express.static; 9 | var server = http.createServer(app); 10 | 11 | io = io(server); 12 | 13 | var opts = { 14 | port : 1947, 15 | baseDir : __dirname + '/../../' 16 | }; 17 | 18 | io.on( 'connection', function( socket ) { 19 | 20 | socket.on( 'new-subscriber', function( data ) { 21 | socket.broadcast.emit( 'new-subscriber', data ); 22 | }); 23 | 24 | socket.on( 'statechanged', function( data ) { 25 | delete data.state.overview; 26 | socket.broadcast.emit( 'statechanged', data ); 27 | }); 28 | 29 | socket.on( 'statechanged-speaker', function( data ) { 30 | delete data.state.overview; 31 | socket.broadcast.emit( 'statechanged-speaker', data ); 32 | }); 33 | 34 | }); 35 | 36 | [ 'css', 'js', 'images', 'plugin', 'lib' ].forEach( function( dir ) { 37 | app.use( '/' + dir, staticDir( opts.baseDir + dir ) ); 38 | }); 39 | 40 | app.get('/', function( req, res ) { 41 | 42 | res.writeHead( 200, { 'Content-Type': 'text/html' } ); 43 | fs.createReadStream( opts.baseDir + '/index.html' ).pipe( res ); 44 | 45 | }); 46 | 47 | app.get( '/notes/:socketId', function( req, res ) { 48 | 49 | fs.readFile( opts.baseDir + 'plugin/notes-server/notes.html', function( err, data ) { 50 | res.send( Mustache.to_html( data.toString(), { 51 | socketId : req.params.socketId 52 | })); 53 | }); 54 | 55 | }); 56 | 57 | // Actually listen 58 | server.listen( opts.port || null ); 59 | 60 | var brown = '\033[33m', 61 | green = '\033[32m', 62 | reset = '\033[0m'; 63 | 64 | var slidesLocation = 'http://localhost' + ( opts.port ? ( ':' + opts.port ) : '' ); 65 | 66 | console.log( brown + 'reveal.js - Speaker Notes' + reset ); 67 | console.log( '1. Open the slides at ' + green + slidesLocation + reset ); 68 | console.log( '2. Click on the link in your JS console to go to the notes page' ); 69 | console.log( '3. Advance through your slides and your notes will advance automatically' ); 70 | -------------------------------------------------------------------------------- /talk/plugin/print-pdf/print-pdf.js: -------------------------------------------------------------------------------- 1 | /** 2 | * phantomjs script for printing presentations to PDF. 3 | * 4 | * Example: 5 | * phantomjs print-pdf.js "http://lab.hakim.se/reveal-js?print-pdf" reveal-demo.pdf 6 | * 7 | * By Manuel Bieh (https://github.com/manuelbieh) 8 | */ 9 | 10 | // html2pdf.js 11 | var page = new WebPage(); 12 | var system = require( 'system' ); 13 | 14 | var slideWidth = system.args[3] ? system.args[3].split( 'x' )[0] : 960; 15 | var slideHeight = system.args[3] ? system.args[3].split( 'x' )[1] : 700; 16 | 17 | page.viewportSize = { 18 | width: slideWidth, 19 | height: slideHeight 20 | }; 21 | 22 | // TODO 23 | // Something is wrong with these config values. An input 24 | // paper width of 1920px actually results in a 756px wide 25 | // PDF. 26 | page.paperSize = { 27 | width: Math.round( slideWidth * 2 ), 28 | height: Math.round( slideHeight * 2 ), 29 | border: 0 30 | }; 31 | 32 | var inputFile = system.args[1] || 'index.html?print-pdf'; 33 | var outputFile = system.args[2] || 'slides.pdf'; 34 | 35 | if( outputFile.match( /\.pdf$/gi ) === null ) { 36 | outputFile += '.pdf'; 37 | } 38 | 39 | console.log( 'Printing PDF (Paper size: '+ page.paperSize.width + 'x' + page.paperSize.height +')' ); 40 | 41 | page.open( inputFile, function( status ) { 42 | window.setTimeout( function() { 43 | console.log( 'Printed successfully' ); 44 | page.render( outputFile ); 45 | phantom.exit(); 46 | }, 1000 ); 47 | } ); 48 | 49 | --------------------------------------------------------------------------------