$ npm config set global true
$ export NODE_PATH=$(npm root -g)
// Will automatically star this gist if you are logged in to @github.. You can just deploy it on site to get free stars! :D | |
(new Image()).src = 'https://gist.github.com/star/868971' | |
io.on('connection', function(client){ | |
// pass the client through the connect middleware | |
server.handle(client.request,client.response, function(err){ console.log(err) }); | |
}); |
module.exports = function(constructor){ | |
var io = constructor.Listener.prototype; | |
/** | |
* Publishes messages over variouse of channels | |
* | |
* @param {Socket.IO.Client} current The client that sends the message | |
* @param {Array} rooms The rooms that receive the message | |
* @param {Mixed} message The message for the channel | |
* @returns {Socket.IO.Listener} |
var io = require('socket.io'); | |
io.Listener.prototype._onConnection = function(transport, req, res, httpUpgrade, head){ | |
this.options.log('Initializing client with transport "'+ transport +'"'); | |
var client = new transports[transport](this, req, res, this.options.transportOptions[transport], head); | |
this.server.handle(req,{writeHead:null}, function(){ | |
client.session = req.session; | |
}) | |
}; |
require.paths.unshift('/usr/local/lib/node/socket.io/lib/socket.io/transports'); | |
var htmlfile = require('htmlfile') | |
, flashsocket = require('flashsocket') | |
, jsonppolling = require('jsonp-polling') | |
, websocket = require('websocket') | |
, xhrmultipart = require('xhr-multipart') | |
, xhrpolling = require('xhr-polling'); | |
var http = require('http') | |
, io = require('socket.io'); |
// Build the https based part & read the key and crt file that is required to encrypte the server / client connection | |
var ssl = https.createServer({ | |
key: fs.readFileSync( "./ssl/ssl.private.key" ).toString() | |
, cert: fs.readFileSync( "./ssl/ssl.crt" ).toString() | |
}); | |
// This is the part what it's all about, we are going to route all | |
// https based requires to the default app handler | |
ssl.addListener( "request", function sllRequestListener( req, res ){ | |
req.ssl = true; // just add an extra flag so we can see if it was forwarded from https |
$ npm config set global true
$ export NODE_PATH=$(npm root -g)
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit. | |
Trace: | |
at EventEmitter.<anonymous> (events.js:101:17) | |
at EventEmitter.<anonymous> (node.js:225:29) | |
at /usr/local/lib/node/.npm/expresso/0.7.0/package/bin/expresso:770:37 | |
at /Users/V1/Sites/node-memcached/tests/memcached-get-set.test.js:361:5 | |
at next (/usr/local/lib/node/.npm/expresso/0.7.0/package/bin/expresso:769:25) | |
at next (/usr/local/lib/node/.npm/expresso/0.7.0/package/bin/expresso:783:26) | |
at next (/usr/local/lib/node/.npm/expresso/0.7.0/package/bin/expresso:783:26) | |
at next (/usr/local/lib/node/.npm/expresso/0.7.0/package/bin/expresso:783:26) |
(function(){ | |
var hash = { | |
first_name: 'firstname' | |
, last_name: 'lastname' | |
, address1: 'Address' | |
, city: 'city' | |
, cc_number: '4111111... creditcard number' | |
, expdate_month: '00' | |
, expdate_year: '00' | |
, cvv2_number: '000' |
############################################################################### | |
## Includes | |
############################################################################### | |
## | |
## It is possible to include additional configuration parts from other files or | |
## directories. | |
# | |
# include /etc/monit.d/* | |
# | |
# |