how to cleartimeout in node.js

Viewed 27694

Hi We are developing application in node.js , socket.io , and redis.

we have this procedure :

exports.processRequest = function (request,result) {
     var self = this;
     var timerknock;
     switch(request._command) {
    case 'some command': // user login with username 
            // some statement 
            timerknock=setTimeout(function() {
                //some  statemetn
            },20*1000);
        case 'other command ':
            // some statement    
            clearTimeout(timerknock);
      }
};

but when it cancel the timer it is not getting canceled when other command is executed , what should i do to cancel the timer ?

1 Answers
Related