Permalink
Browse files

[minor] Code cleanup

  • Loading branch information...
1 parent f47c7f0 commit edb93f28c0dfa0f4d1c4b6a379007f801336f894 @Marak Marak committed Aug 25, 2012
Showing with 13 additions and 7 deletions.
  1. +7 −4 lib/engines/socketio.js
  2. +6 −3 lib/socketful.js
View
@@ -11,10 +11,12 @@ engine.createServer = function (resources, options, callback) {
//
// For every resource, create a new socket.io handler
//
+ // console.log('mapping', resource.lowerResource)
+
+ //
+ // Remark: Delegate the resource action to the appropiate engine method
+ //
socket.on(resource.lowerResource, function (action, payload, callback) {
- //
- // Remark: Delegate the resource action to the appropiate engine method
- //
//
// CRUD methods
@@ -29,11 +31,12 @@ engine.createServer = function (resources, options, callback) {
if(typeof resource[action] === 'function' && resource[action].remote) {
return resource[action](payload.id, payload, callback);
}
+
return callback(new Error(action + ' is not a valid action.'));
});
});
socket.on('disconnect', function () {
- console.log('got a disconnect');
+ // console.log('got a disconnect');
});
});
return io;
View
@@ -42,10 +42,13 @@ exports.name = 'socketful';
//
exports.init = function (done) {
var app = this;
-
+ //
+ // TODO: better integration when using as Flatiron plugin:
+ //
+ // app.use(flatiron.plugins.socketful);
+ //
if (app.resources) {
- //socketful.createServer(app.resources);
+ // return socketful.createServer(app.resources, { server: app.server }, done);
}
-
done();
};

0 comments on commit edb93f2

Please sign in to comment.