Handling packets in nodejs for MMORPG
You should compartmentalize your "handlers" for each of the packets.  Each handler should contain a canHandle method that determines whether it can process the packet and a process method that does the work.  Example:

var packet300Handler = {
    canHandle: function(packet) {
        return packet.id === 300;
    },
    process: function(packet) {
        // Do work here.
    }
};

var handlers = [packet300Handler, packet301Handler, packet302Handler];

client.on('data', function(data) {
    parser.extract('DATA', function(packet) {
        for (var i = 0; i &lt; handlers.length; i++) {
            var handler = handlers[i];

            if (handler.canHandle(packet)) {
                handler.process(packet);
                break; // Leave loop now that something has handled the packet.
            }
        }
    });
});