upgrade socket.io and express.js

required some retooling of how everything is setup
This commit is contained in:
ali asaria 2014-08-17 13:36:34 -04:00
parent 08f86a0566
commit 8f2863f86e
4 changed files with 72 additions and 100 deletions

View file

@ -17,7 +17,7 @@
"async": "~0.9.0", "async": "~0.9.0",
"redis": "~0.12.1", "redis": "~0.12.1",
"sanitizer": "~0.1.1", "sanitizer": "~0.1.1",
"socket.io": "0.8.x", "socket.io": "1.x",
"simplesets": "~1.2.0", "simplesets": "~1.2.0",
"express": "4.x", "express": "4.x",
"jade": "~1.5.0" "jade": "~1.5.0"

View file

@ -20,31 +20,15 @@ var data = require('./lib/data.js').db;
var sids_to_user_names = []; var sids_to_user_names = [];
/************** /**************
SETUP SETUP EXPRESS
**************/ **************/
var app = express(); var app = express();
app.configure( function(){ app.use(express.static(__dirname + '/client'));
app.use(express.static(__dirname + '/client'));
app.use(express.bodyParser());
//app.use(express.cookieParser());
//Cookies are not really needed... but may be in the future?
app.use(express.cookieParser());
app.use(
express.session({
key: "scrumscrum-cookie",
secret: "kookoorikoo",
// store: session_store,
cookie: { path: '/', httpOnly: true, maxAge: 14400000 }
})
);
});
app.listen(process.argv[2] || 8124);
var server = require('http').Server(app);
server.listen(process.argv[2] || 8080);
//app.listen(process.argv[2] || 8080);
/************** /**************
ROUTES ROUTES
@ -53,21 +37,21 @@ app.get('/', function(req, res) {
//console.log(req.header('host')); //console.log(req.header('host'));
url = req.header('host'); url = req.header('host');
res.render('home.jade', { res.render('home.jade', {
layout: false, url: url
locals: {url: url}
}); });
}); });
app.get('/demo', function(req, res) { app.get('/demo', function(req, res) {
res.render('index.jade', { res.render('index.jade', {
locals: {pageTitle: 'scrumblr - demo', demo: true} pageTitle: 'scrumblr - demo',
demo: true
}); });
}); });
app.get('/:id', function(req, res){ app.get('/:id', function(req, res){
res.render('index.jade', { res.render('index.jade', {
locals: {pageTitle: ('scrumblr - ' + req.params.id) } pageTitle: ('scrumblr - ' + req.params.id)
}); });
}); });
@ -75,24 +59,8 @@ app.get('/:id', function(req, res){
/************** /**************
SOCKET.I0 SOCKET.I0
**************/ **************/
//I limit the number of potential transports because xhr was causing trouble var io = require('socket.io')(server);
//with frequent disconnects
var socketio_options = {
transports: ['websocket', 'flashsocket', 'htmlfile', 'jsonp-polling']
};
// socket.io SETUP
var io = require('socket.io').listen(app);
io.configure(function () {
io.set('transports', [
'websocket'
, 'flashsocket'
, 'htmlfile'
// , 'xhr-polling'
, 'jsonp-polling'
]);
io.set('log level', 1);
});
io.sockets.on('connection', function (client) { io.sockets.on('connection', function (client) {
//santizes text //santizes text
function scrub( text ) { function scrub( text ) {

View file

@ -1,67 +1,70 @@
- if (locals.demo) extends layout
div.notice-bar this is a demo board. to make a private board, go to <a href="http://scrumblr.ca">scrumblr.ca</a>
h1 <a href="http://scrumblr.ca">scrumblr</a> by <a href="http://aliasaria.ca">aliasaria</a> block body
- if (locals.demo)
div.notice-bar this is a demo board. to make a private board, go to <a href="http://scrumblr.ca">scrumblr.ca</a>
div.board-outline h1 <a href="http://scrumblr.ca">scrumblr</a> by <a href="http://aliasaria.ca">aliasaria</a>
div#board
div#board-doodles div.board-outline
image#marker(src='/images/marker.png') div#board
image#eraser(src='/images/eraser.png') div#board-doodles
image#marker(src='/images/marker.png')
image#eraser(src='/images/eraser.png')
table#board-table.board-table table#board-table.board-table
tr tr
td#icon-col(width='1%') td#icon-col(width='1%')
image#add-col.col-icon(width='20', height='20', src='/images/icons/iconic/raster/black/plus_alt_32x32.png') image#add-col.col-icon(width='20', height='20', src='/images/icons/iconic/raster/black/plus_alt_32x32.png')
image#delete-col.col-icon(width='20', height='20', src='/images/icons/iconic/raster/black/minus_alt_32x32.png') image#delete-col.col-icon(width='20', height='20', src='/images/icons/iconic/raster/black/minus_alt_32x32.png')
div.buttons div.buttons
image#create-card.bottom-icon(width='24', height='24', src='/images/icons/iconic/raster/black/plus_alt_24x24.png') image#create-card.bottom-icon(width='24', height='24', src='/images/icons/iconic/raster/black/plus_alt_24x24.png')
image#smallify.bottom-icon(width="23",height="23",src="/images/icons/cc/black/png/zoom_icon&24.png") image#smallify.bottom-icon(width="23",height="23",src="/images/icons/cc/black/png/zoom_icon&24.png")
div.stickers div.stickers
div.sticker#sticker-red div.sticker#sticker-red
image(src="/images/stickers/sticker-red.png") image(src="/images/stickers/sticker-red.png")
div.sticker#sticker-blue div.sticker#sticker-blue
image(src="/images/stickers/sticker-blue.png") image(src="/images/stickers/sticker-blue.png")
div.sticker#sticker-yellow div.sticker#sticker-yellow
image(src="/images/stickers/sticker-yellow.png") image(src="/images/stickers/sticker-yellow.png")
div.sticker#sticker-green div.sticker#sticker-green
image(src="/images/stickers/sticker-green.png") image(src="/images/stickers/sticker-green.png")
br br
div.sticker#sticker-pink div.sticker#sticker-pink
image(src="/images/stickers/sticker-pink.png") image(src="/images/stickers/sticker-pink.png")
div.sticker#sticker-lightblue div.sticker#sticker-lightblue
image(src="/images/stickers/sticker-lightblue.png") image(src="/images/stickers/sticker-lightblue.png")
div.sticker#sticker-orange div.sticker#sticker-orange
image(src="/images/stickers/sticker-orange.png") image(src="/images/stickers/sticker-orange.png")
div.sticker#sticker-purple div.sticker#sticker-purple
image(src="/images/stickers/sticker-purple.png") image(src="/images/stickers/sticker-purple.png")
br br
div.sticker#nosticker div.sticker#nosticker
image(src="/images/stickers/sticker-deletestar.png") image(src="/images/stickers/sticker-deletestar.png")
//br //br
//div.sticker#sticker-gold //div.sticker#sticker-gold
// image(src="/images/stickers/sticker-gold.png") // image(src="/images/stickers/sticker-gold.png")
//div.sticker#sticker-bluestar //div.sticker#sticker-bluestar
// image(src="/images/stickers/sticker-bluestar.png") // image(src="/images/stickers/sticker-bluestar.png")
//div.sticker#sticker-silverstar //div.sticker#sticker-silverstar
// image(src="/images/stickers/sticker-silverstar.png") // image(src="/images/stickers/sticker-silverstar.png")
//div.sticker#sticker-redstar //div.sticker#sticker-redstar
// image(src="/images/stickers/sticker-redstar.png") // image(src="/images/stickers/sticker-redstar.png")
div.names div.names
p connected: p connected:
//image#user-icon(src="/images/icons/cc/black/png/user_icon&16.png") //image#user-icon(src="/images/icons/cc/black/png/user_icon&16.png")
input#yourname-input input#yourname-input
span.you-text (you) span.you-text (you)
ul#names-ul ul#names-ul
//<div style="width: 980px; height: 450px; border: solid 2px; opacity:.1; margin-top: 100px"> this will be the backlog that only appears on drag or perhaps not at all</div> //<div style="width: 980px; height: 450px; border: solid 2px; opacity:.1; margin-top: 100px"> this will be the backlog that only appears on drag or perhaps not at all</div>
<script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-2069672-4']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-2069672-4']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script>

View file

@ -27,4 +27,5 @@ html(lang="en")
title= locals.pageTitle title= locals.pageTitle
body!= body body
block body