Skip to content

Commit

Permalink
basic r/w persistence
Browse files Browse the repository at this point in the history
  • Loading branch information
dvv committed Jun 14, 2011
1 parent 8baa404 commit aeba6b2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions example/server.js
Expand Up @@ -76,6 +76,7 @@ var ws = io.Context(http, {

ws.sockets.on('connection', function(client) {

// FIXME: cid should come from session
client.cid = 'dvv';
console.log('CLIENT', client.context);

Expand Down Expand Up @@ -103,6 +104,8 @@ ws.sockets.on('connection', function(client) {
} catch(err) {}
client.on('change', function(changes) {
console.log('CHANGED. NEED TO SAVE UPDATES', this.id, changes);
// FIXME: prototype should not go to db
db.set('c/' + client.cid, JSON.stringify(this.context))
});
client.emit('ready', function(x) {
console.log('READY CONFIRMED', x, this.id);
Expand Down

0 comments on commit aeba6b2

Please sign in to comment.