Permalink
Browse files

Removing junk.

  • Loading branch information...
1 parent e81c243 commit ec3518c6e05a60fe916c5a1394ae08fcd8be31ee @aviddiviner committed Jun 24, 2011
Showing with 0 additions and 232 deletions.
  1. +0 −96 example/.svn/entries
  2. +0 −99 example/.svn/text-base/app.js.svn-base
  3. +0 −37 example/.svn/text-base/ping.html.svn-base
View
@@ -1,96 +0,0 @@
-10
-
-dir
-174
-file:///var/svnrepo/Socket.IO-sessions/example
-file:///var/svnrepo
-
-
-
-2011-06-24T20:05:58.786957Z
-174
-dave
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-7b580288-3b97-9849-81df-7a9137988b17
-
-ping.html
-file
-
-
-
-
-2011-06-24T20:05:51.371248Z
-895509241fb0a9a23994e397385cf6a6
-2011-06-24T20:05:58.786957Z
-174
-dave
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-963
-
-app.js
-file
-
-
-
-
-2011-06-24T20:05:51.371248Z
-132917bd109cb46df24c75543de331c4
-2011-06-24T20:05:58.786957Z
-174
-dave
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-3003
-
@@ -1,99 +0,0 @@
-// Config
-var PORT = 3000;
-
-// Dependencies
-require.paths.unshift('/usr/local/lib/node_modules'); // NPM global packages
-
-var connect = require('connect'),
- fs = require('fs'),
- io = require('socket.io'),
- sio = require('..');
-
-var inspect = require('eyes').inspector();
-
-// Create the session store
-var MemoryStore = require('connect/lib/middleware/session/memory');
-mystore = new MemoryStore;
-
-// Create the webserver
-var app = connect.createServer(
- connect.cookieParser(),
- connect.session({secret:'faceroll here', store:mystore}),
- function(req, res, next){
- var session = req.session;
- inspect(session);
- fs.readFile(__dirname + '/ping.html', function(err, data){
- if (err) throw err;
- res.end(data);
- });
- }
-);
-
-// Pretty console messages
-console.red = function(msg){
- console.log("\033[31m" + msg + "\033[0m");
-}
-console.green = function(msg){
- console.log("\033[32m" + msg + "\033[0m");
-}
-console.yellow = function(msg){
- console.log("\033[33m" + msg + "\033[0m");
-}
-
-// Socket.IO
-var load_session_per_message = false;
-
-var socket = sio.enable({
- socket: io.listen(app),
- store: mystore,
- parser: connect.cookieParser(),
- per_message: load_session_per_message
-});
-
-app.listen(PORT);
-
-if (load_session_per_message) {
-
- // Session is saved after each message
- socket.on('sconnection', function(client){
- console.yellow('Client connected.');
- client.on('smessage', function(message, session){
- session.pings = session.pings + 1 || 1;
- console.red('Message: ' + JSON.stringify(message));
- console.red('Session: ' + JSON.stringify(session));
- });
- client.on('disconnect', function(){
- console.yellow('Client disconnected.');
- });
- });
- socket.on('sinvalid', function(client){
- console.yellow('Session invalid, send the client some instructions to refresh.');
- });
-
-} else {
-
- // Session is saved on disconnect
- socket.on('sconnection', function(client, session){
- session.conns = session.conns + 1 || 1;
- console.yellow('Client connected. Loaded session.');
- console.yellow('Session: ' + JSON.stringify(session));
- client.on('message', function(message){
- session.pings = session.pings + 1 || 1;
- console.green('Message: ' + JSON.stringify(message));
- });
- client.on('smessage', function(message, session){
- session.pings = session.pings + 1 || 1;
- console.red('Message: ' + JSON.stringify(message));
- console.red('Session: ' + JSON.stringify(session));
- });
- client.on('disconnect', function(){
- console.yellow('Client disconnected. Saving session.');
- });
- });
- socket.on('sinvalid', function(client){
- console.yellow('Session invalid, send the client some instructions to refresh.');
- });
-
-}
-
-console.log('Listening on http://0.0.0.0:' + PORT);
@@ -1,37 +0,0 @@
-<html>
-<head>
- <script src="/socket.io/socket.io.js"></script>
- <script src="/socket.io/socket.io-sessions.js"></script>
- <script>
- var logmsg = function(msg){
- document.getElementById('msgbox').innerHTML += msg + '\n';
- };
-
- var socket = io.connectWithSession();
- socket.on('connect', function(){
- logmsg('<b>Connect!</b>');
- });
- socket.on('disconnect', function(){
- logmsg('<b>Disconnect!</b>');
- });
- socket.on('message', function(message){
- logmsg('Message: ' + JSON.stringify(message));
- });
- socket.on('hi', function(message){
- logmsg('Hi: ' + JSON.stringify(message));
- });
-
-/*
- var socket = io.connect('/chat');
- var news = io.connect('/news');
- news.on('item', function(){
- // do stuff
- });
-*/
- </script>
-</head>
-<body>
- <input id="sendmsg" type="button" value="Ping!" onclick="socket.send('ping', function(){ logmsg('(msg sent)'); });" />
- <pre id="msgbox"></pre>
-</body>
-</html>

0 comments on commit ec3518c

Please sign in to comment.