-
-
Save tanepiper/c9609b3c03798a5f940a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(instance, session, stream) { | |
var dnode = require('dnode'); | |
var twitter = require('ntwitter'); | |
//var dnodeSession = require('dnode-session')({store: instance.sessions}); | |
//var twitter = require('./../apps/twitter/')(instance, req); | |
var d = dnode(); | |
d.on('remote', function(remote) { | |
console.log(remote); | |
}); | |
/* | |
d.on('local', function(local) { | |
console.log('local', local); | |
local.serverfoo = function(c, cb) { | |
console.log(c); | |
cb(null, [c, Date.now()]); | |
}; | |
}); | |
d.on('fail', function() { | |
console.log('fail', arguments); | |
}); | |
d.on('error', function(e) { | |
console.log('error', e); | |
}); | |
*/ | |
/* | |
var refresh = setInterval(function() { | |
console.log('touching session'); | |
session.touch(); | |
console.log(session); | |
}, 5000); | |
*/ | |
/* | |
d.on('end', function() { | |
console.log('end', arguments); | |
//clearTimeout(refresh); | |
}); | |
*/ | |
session.dnode = d; | |
d.pipe(stream).pipe(d); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* External Dependencies | |
*/ | |
var _ = require('underscore'); | |
/** | |
* This module exports a route for the home page of the application after login | |
*/ | |
module.exports = function(instance) { | |
/** | |
* The function returned to the express rotue | |
*/ | |
return function(req, res, next) { | |
if (!req.session.oauth) { | |
return res.redirect('/'); | |
} | |
require('./../../sockjs_server')(instance, req.session); | |
res.render('app', { session: req.session }); | |
}; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sockjs = require('sockjs'); | |
module.exports = function(instance, session) { | |
var server = sockjs.createServer(); | |
server.on('connection', function(stream) { | |
require('./dnode_server')(instance, session, stream); | |
}); | |
server.installHandlers(instance.express, { prefix : '/dnode' }); | |
session.sockjs = server; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment