<commit_before>
kerubApp.factory('$socket', ['$interval', '$log', function($interval, $log) {
    $log.info("init socket");
    var socketAddr = (location.protocol == 'http:' ? 'ws:' : 'wss:')
        + '//' + location.hostname
        + ':' + location.port
        + "/ws";
    $log.info("socket addr:"+socketAddr);
    var sock = {};
    var socket = new WebSocket(socketAddr, 'kerub');
    sock.socket = socket;
    sock.queue = [];
    socket.onopen = function() {
        $log.info('connection established');
        for(i = 0; i < sock.queue.length; i++) {
            $log.debug('delayed sending msg', sock.queue[i]);
            sock.socket.send(angular.toJson(sock.queue[i]));
        }
        $log.debug('all msg sent');
        sock.queue = [];
    };
    sock.send = function(msg) {
        if(sock.socket.readyState == WebSocket.OPEN) {
            sock.socket.send(angular.toJson(msg));
        } else {
            $log.info("not connected, send delayed", msg);
            sock.queue.push(msg);
        }
    }
    sock.subscribe = function(channel, callback) {
        var msg = {
            "@type" : 'subscribe',
            channel : channel
        };
        try {
            $log.debug('sending subscribe');
            sock.send(msg);
            $log.debug('subscribe sent');
        } catch (e) {
            $log.debug('subscribe was not sent', e);
        }
    };
    sock.unsubscribe = function(channel) {
        var msg = {
            "@type" : 'unsubscribe',
            channel : 'channel'
        };
        socket.send(msg);
    };
    $interval(function() {
        $log.debug('ping server');<commit_msg>missing semicolon added<commit_after>
kerubApp.factory('$socket', ['$interval', '$log', function($interval, $log) {
    $log.info("init socket");
    var socketAddr = (location.protocol == 'http:' ? 'ws:' : 'wss:')
        + '//' + location.hostname
        + ':' + location.port
        + "/ws";
    $log.info("socket addr:"+socketAddr);
    var sock = {};
    var socket = new WebSocket(socketAddr, 'kerub');
    sock.socket = socket;
    sock.queue = [];
    socket.onopen = function() {
        $log.info('connection established');
        for(i = 0; i < sock.queue.length; i++) {
            $log.debug('delayed sending msg', sock.queue[i]);
            sock.socket.send(angular.toJson(sock.queue[i]));
        }
        $log.debug('all msg sent');
        sock.queue = [];
    };
    sock.send = function(msg) {
        if(sock.socket.readyState == WebSocket.OPEN) {
            sock.socket.send(angular.toJson(msg));
        } else {
            $log.info("not connected, send delayed", msg);
            sock.queue.push(msg);
        }
    };
    sock.subscribe = function(channel, callback) {
        var msg = {
            "@type" : 'subscribe',
            channel : channel
        };
        try {
            $log.debug('sending subscribe');
            sock.send(msg);
            $log.debug('subscribe sent');
        } catch (e) {
            $log.debug('subscribe was not sent', e);
        }
    };
    sock.unsubscribe = function(channel) {
        var msg = {
            "@type" : 'unsubscribe',
            channel : 'channel'
        };
        socket.send(msg);
    };
    $interval(function() {
        $log.debug('ping server');
{'fraction_non_alphanumeric': 0.17116025446834293, 'fraction_numerical': 0.0006058770069675856, 'mean_word_length': 1.8939526730937775, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4712035', 'n_tokens_mistral': 981, 'n_tokens_neox': 982, 'n_words': 187}