<commit_before>/**
 * Module dependencies.
 */

var express = require('express')
  , app = express()
  , server = require('http').createServer(app)
  , routes = require('./routes')
  , path = require('path')
  , io = require('socket.io').listen(server);

var clients = [];

var sendMessages = function(msg) {
  for (var i = 0; i < clients.length; i++) {
    clients[i].emit('news', { text: msg});
  }
};

io.configure(function() {
  io.set("transports", ['websocket', 'flashsocket', 'htmlfile', 'xhr-polling', 'jsonp-polling']);
  io.set("polling duration", 10);
});

io.sockets.on('connection', function(socket) {
  var index = clients.push(socket) - 1;
  socket.emit('news', { text: 'Hello World' });
  socket.on('message', function(data) {
    sendMessages(data.text);
  });
  socket.on("disconnect", function() {
    clients.splice(index, 1);
  });

});

app.get('/', function(req, res) {
  res.sendfile(__dirname + '/views/index.html');
});
var port = process.env.PORT || 3000;
server.listen(port);<commit_msg>added basic logging<commit_after>/**
 * Module dependencies.
 */

var express = require('express')
  , app = express()
  , server = require('http').createServer(app)
  , routes = require('./routes')
  , path = require('path')
  , io = require('socket.io').listen(server);

var clients = [];

var sendMessages = function(msg) {
  for (var i = 0; i < clients.length; i++) {
    clients[i].emit('news', { text: msg});
  }
};

io.configure(function() {
  io.set("transports", ['websocket', 'flashsocket', 'htmlfile', 'xhr-polling', 'jsonp-polling']);
  io.set("polling duration", 10);
});

io.sockets.on('connection', function(socket) {
  var index = clients.push(socket) - 1;
  socket.emit('news', { text: 'Hello World' });
  socket.on('message', function(data) {
    console.info("received message, sending", data.text)
    sendMessages(data.text);
  });
  socket.on("disconnect", function() {
    clients.splice(index, 1);
  });

});

app.get('/', function(req, res) {
  res.sendfile(__dirname + '/views/index.html');
});
var port = process.env.PORT || 3000;
server.listen(port);
{'fraction_non_alphanumeric': 0.2140468227424749, 'fraction_numerical': 0.008600095556617296, 'mean_word_length': 4.2481203007518795, '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': '3963547', 'n_tokens_mistral': 725, 'n_tokens_neox': 709, 'n_words': 141}