<commit_before>const channel_name = 'dl.channel.votes';
const redis = require('redis');
var port = process.env.PORT || 3000;
const io = require('socket.io').listen(port);

io.sockets.on('connection', function(client) {
    
    const sub;
    
    //Heroku production authentication
    if (process.env.REDISTOGO_URL) {
        var rtg = require("url").parse(process.env.REDISTOGO_URL);
        sub = redis.createClient(rtg.port, rtg.hostname);
        sub.auth(rtg.auth.split(":")[1]);
    } else {
        sub = redis.createClient(); //create a new subscriber connection        
    }
    
    sub.subscribe(channel_name);  //listen for messages published on this channel

    client.on('join', function(session_id) {
        client.set('vote_session', session_id);
        client.join(session_id);
        console.log("user joined /"+session_id);
    });

    sub.on("message", function(channel, session) {
        var session_id = JSON.parse(session).uuid; //this is a waste, there's probably a way to avoid it
        client.get('vote_session',function(err,vote_session) { //we only want to send updates to clients in this vote session
            if(vote_session == session_id) {
              client.emit('vote', session);              
            }
        });
    });

    client.on('disconnect', function() {
        client.get('vote_session',function(err,vote_session) {
            client.leave("/"+vote_session);
            sub.quit();
            console.log("user left /"+vote_session);                        
        });
    });
    
});                   <commit_msg>commenting out debug statements in app.js<commit_after>const channel_name = 'dl.channel.votes';
const redis = require('redis');
var port = process.env.PORT || 3000;
const io = require('socket.io').listen(port);

io.sockets.on('connection', function(client) {
    
    const sub;
    
    //Heroku production authentication
    if (process.env.REDISTOGO_URL) {
        var rtg = require("url").parse(process.env.REDISTOGO_URL);
        sub = redis.createClient(rtg.port, rtg.hostname);
        sub.auth(rtg.auth.split(":")[1]);
    } else {
        sub = redis.createClient(); //create a new subscriber connection        
    }
    
    sub.subscribe(channel_name);  //listen for messages published on this channel

    client.on('join', function(session_id) {
        client.set('vote_session', session_id);
        client.join(session_id);
        //console.log("user joined /"+session_id);
    });

    sub.on("message", function(channel, session) {
        var session_id = JSON.parse(session).uuid; //this is a waste, there's probably a way to avoid it
        client.get('vote_session',function(err,vote_session) { //we only want to send updates to clients in this vote session
            if(vote_session == session_id) {
              client.emit('vote', session);              
            }
        });
    });

    client.on('disconnect', function() {
        client.get('vote_session',function(err,vote_session) {
            client.leave("/"+vote_session);
            sub.quit();
            //console.log("user left /"+vote_session);                        
        });
    });
    
});                   
{'fraction_non_alphanumeric': 0.13942607610729882, 'fraction_numerical': 0.0031191515907673115, 'mean_word_length': 2.3164426059979317, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4160854', 'n_tokens_mistral': 937, 'n_tokens_neox': 916, 'n_words': 195}