https://mattbrictson.com/nginx-reverse-proxy-cache
https://www.nginx.com/resources/wiki/start/topics/examples/full/
| let hasBlobConstructor = typeof(Blob) !== 'undefined' && (function () { | |
| try { | |
| return Boolean(new Blob()); | |
| } catch (e) { | |
| return false; | |
| } | |
| }()); | |
| let hasArrayBufferViewSupport = hasBlobConstructor && typeof(Uint8Array) !== 'undefined' && (function () { | |
| try { |
| user web; | |
| # One worker process per CPU core. | |
| worker_processes 8; | |
| # Also set | |
| # /etc/security/limits.conf | |
| # web soft nofile 65535 | |
| # web hard nofile 65535 | |
| # /etc/default/nginx |
| { | |
| "env": { | |
| "browser": true, | |
| "node": true, | |
| "es6": true | |
| }, | |
| "plugins": ["react"], | |
| "ecmaFeatures": { |
brew install fish
curl -L https://get.oh-my.fish | fish| error_page 500 /500.html; | |
| location /500.html{ | |
| return 500 '{"error": {"status_code": 500,"status": "Internal Server Error"}}'; | |
| } | |
| error_page 502 /502.html; | |
| location /502.html{ | |
| return 502 '{"error": {"status_code": 502,"status": "Bad Gateway"}}'; | |
| } |
| /* ******************************************************************************************* | |
| * THE UPDATED VERSION IS AVAILABLE AT | |
| * https://github.com/LeCoupa/awesome-cheatsheets | |
| * ******************************************************************************************* */ | |
| // 0. Synopsis. | |
| // http://nodejs.org/api/synopsis.html |
I client connects to a sever specifying a room they wish to join, that client is then binded to that one and only room.
The server broadcasts a event to the room, forwarding the message on to any other connected clients.
In the below example connected_client.js is listening to any messages, and will log the output.
[message]: {"room": "anything", "greeting": "Hello world"}
| var restify = require('restify'); | |
| // Authentication | |
| var passport = require('passport'); | |
| var LocalStrategy = require('passport-local').Strategy; | |
| var sessions = require("client-sessions"); | |
| var server = restify.createServer(); | |
| server.use(restify.queryParser()); | |
| server.use(restify.bodyParser()); |