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",
"redis": "~0.12.1",
"sanitizer": "~0.1.1",
"socket.io": "0.8.x",
"socket.io": "1.x",
"simplesets": "~1.2.0",
"express": "4.x",
"jade": "~1.5.0"

View file

@ -20,31 +20,15 @@ var data = require('./lib/data.js').db;
var sids_to_user_names = [];
/**************
SETUP
SETUP EXPRESS
**************/
var app = express();
app.configure( function(){
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);
app.use(express.static(__dirname + '/client'));
var server = require('http').Server(app);
server.listen(process.argv[2] || 8080);
//app.listen(process.argv[2] || 8080);
/**************
ROUTES
@ -53,21 +37,21 @@ app.get('/', function(req, res) {
//console.log(req.header('host'));
url = req.header('host');
res.render('home.jade', {
layout: false,
locals: {url: url}
url: url
});
});
app.get('/demo', function(req, res) {
res.render('index.jade', {
locals: {pageTitle: 'scrumblr - demo', demo: true}
pageTitle: 'scrumblr - demo',
demo: true
});
});
app.get('/:id', function(req, res){
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
**************/
//I limit the number of potential transports because xhr was causing trouble
//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'
]);
var io = require('socket.io')(server);
io.set('log level', 1);
});
io.sockets.on('connection', function (client) {
//santizes text
function scrub( text ) {

View file

@ -1,9 +1,12 @@
- if (locals.demo)
extends layout
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>
h1 <a href="http://scrumblr.ca">scrumblr</a> by <a href="http://aliasaria.ca">aliasaria</a>
h1 <a href="http://scrumblr.ca">scrumblr</a> by <a href="http://aliasaria.ca">aliasaria</a>
div.board-outline
div.board-outline
div#board
div#board-doodles
image#marker(src='/images/marker.png')
@ -17,12 +20,12 @@ div.board-outline
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#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
image(src="/images/stickers/sticker-red.png")
div.sticker#sticker-blue
@ -54,7 +57,7 @@ div.stickers
// image(src="/images/stickers/sticker-redstar.png")
div.names
div.names
p connected:
//image#user-icon(src="/images/icons/cc/black/png/user_icon&16.png")
input#yourname-input
@ -62,6 +65,6 @@ div.names
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
body!= body
body
block body