<commit_before>var sockjs = require('sockjs');

exports.install = function(config, server) {
    var sjs_echo = new sockjs.Server(config.opts);
    sjs_echo.on('open', function(conn){
                    console.log('    [+] echo open    ' + conn);
                    conn.on('close', function(e) {
                                console.log('    [-] echo close   ' + conn, e);
                            });
                    conn.on('message', function(e) {
                                var d  = JSON.stringify(e.data);
                                console.log('    [ ] echo message ' + conn,
                                            d.slice(0,64)+
                                            ((d.length > 64) ? '...' : ''));
                                conn.send(e.data);
                            });
                });

    var sjs_close = new sockjs.Server(config.opts);
    sjs_close.on('open', function(conn){
                     console.log('    [+] clos open    ' + conn);
                     conn.close(3000, "Go away!");
                     conn.on('close', function(e) {
                                 console.log('    [-] clos close   ' + conn, e);
                             });
                 });

    var sjs_ticker = new sockjs.Server(config.opts);
    sjs_ticker.on('open', function(conn){
                      console.log('    [+] ticker open   ' + conn);
                      var tref;
                      var schedule = function() {
                          conn.send('tick!');
                          tref = setTimeout(schedule, 1000);
                      };
                      tref = setTimeout(schedule, 1000);
                      conn.on('close', function(e) {
                                  clearTimeout(tref);
                                  console.log('    [-] ticker close   ' + conn, e);
                              });
                  });

    var broadcast = {};
    var sjs_broadcast = new sockjs.Server(config.opts);
    sjs_broadcast.on('open', function(conn){
                         console.log('    [+] broadcast open ' + conn);
                         broadcast[conn.id] = conn;
                         conn.on('close', function(e) {
                                     delete broadcast[conn.id];
                                     console.log('    [-] broadcast close' + conn, e);
                                 });
                         conn.on('message', function(e) {
                                     console.log('    [-] broadcast message', e);
                                     for(var id in broadcast) {
                                         broadcast[id].send(e.data);
                                     }
                                 });
                     });

    var sjs_amplify = new sockjs.Server(config.opts);
    sjs_amplify.on('open', function(conn){
                    console.log('    [+] amp open    ' + conn);
                    conn.on('close', function(e) {
                                console.log('    [-] amp close   ' + conn, e);
                            });
                    conn.on('message', function(e) {
                                var n = Math.floor(Number(e.data));
                                n = (n > 0 && n < 19) ? n : 1;
                                console.log('    [ ] amp message: 2^' + n);
                                conn.send(Array(Math.pow(2, n)+1).join('x'));
                            });
                });


    sjs_echo.installHandlers(server, {prefix:'[/]echo'});
    sjs_echo.installHandlers(server, {prefix:'[/]disabled_websocket_echo',
                                      disabled_transports: ['websocket']});
    sjs_close.installHandlers(server, {prefix:'[/]close'});
    sjs_ticker.installHandlers(server, {prefix:'[/]ticker'});
    sjs_amplify.installHandlers(server, {prefix:'[/]amplify'});
    sjs_broadcast.installHandlers(server, {prefix:'[/]broadcast'});
};
<commit_msg>Be less verbose during tests.<commit_after>var sockjs = require('sockjs');

exports.install = function(config, server) {
    var sjs_echo = new sockjs.Server(config.opts);
    sjs_echo.on('open', function(conn){
                    console.log('    [+] echo open    ' + conn);
                    conn.on('close', function(e) {
                                console.log('    [-] echo close   ' + conn);
                            });
                    conn.on('message', function(e) {
                                var d  = JSON.stringify(e.data);
                                console.log('    [ ] echo message ' + conn,
                                            d.slice(0,64)+
                                            ((d.length > 64) ? '...' : ''));
                                conn.send(e.data);
                            });
                });

    var sjs_close = new sockjs.Server(config.opts);
    sjs_close.on('open', function(conn){
                     console.log('    [+] clos open    ' + conn);
                     conn.close(3000, "Go away!");
                     conn.on('close', function(e) {
                                 console.log('    [-] clos close   ' + conn);
                             });
                 });

    var sjs_ticker = new sockjs.Server(config.opts);
    sjs_ticker.on('open', function(conn){
                      console.log('    [+] ticker open   ' + conn);
                      var tref;
                      var schedule = function() {
                          conn.send('tick!');
                          tref = setTimeout(schedule, 1000);
                      };
                      tref = setTimeout(schedule, 1000);
                      conn.on('close', function(e) {
                                  clearTimeout(tref);
                                  console.log('    [-] ticker close   ' + conn);
                              });
                  });

    var broadcast = {};
    var sjs_broadcast = new sockjs.Server(config.opts);
    sjs_broadcast.on('open', function(conn){
                         console.log('    [+] broadcast open ' + conn);
                         broadcast[conn.id] = conn;
                         conn.on('close', function(e) {
                                     delete broadcast[conn.id];
                                     console.log('    [-] broadcast close' + conn);
                                 });
                         conn.on('message', function(e) {
                                     console.log('    [-] broadcast message', e);
                                     for(var id in broadcast) {
                                         broadcast[id].send(e.data);
                                     }
                                 });
                     });

    var sjs_amplify = new sockjs.Server(config.opts);
    sjs_amplify.on('open', function(conn){
                    console.log('    [+] amp open    ' + conn);
                    conn.on('close', function(e) {
                                console.log('    [-] amp close   ' + conn);
                            });
                    conn.on('message', function(e) {
                                var n = Math.floor(Number(e.data));
                                n = (n > 0 && n < 19) ? n : 1;
                                console.log('    [ ] amp message: 2^' + n);
                                conn.send(Array(Math.pow(2, n)+1).join('x'));
                            });
                });


    sjs_echo.installHandlers(server, {prefix:'[/]echo'});
    sjs_echo.installHandlers(server, {prefix:'[/]disabled_websocket_echo',
                                      disabled_transports: ['websocket']});
    sjs_close.installHandlers(server, {prefix:'[/]close'});
    sjs_ticker.installHandlers(server, {prefix:'[/]ticker'});
    sjs_amplify.installHandlers(server, {prefix:'[/]amplify'});
    sjs_broadcast.installHandlers(server, {prefix:'[/]broadcast'});
};

{'fraction_non_alphanumeric': 0.1334169278996865, 'fraction_numerical': 0.006018808777429467, 'mean_word_length': 0.9915106117353308, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 44, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7617711', 'n_tokens_mistral': 2086, 'n_tokens_neox': 1928, 'n_words': 339}