<commit_before>var content = require('./lib/content'),
  fs = require('fs'),
  integrations = require('./integrations/integrations'),
  router = require('router')(),
  server = require('http').Server(),
  io = require('socket.io')(server);

var port = process.env.PORT || 8000;

server.on('request', router);
server.listen(port);

console.log('Server running on ' + port);

router.get('/', content.static('index.html'));
router.get('/index.js', content.static('index.js'));
router.get('/styles.css', content.static('styles.css'));

router.post('/integration/{integration}/{token}', function(req, res) {
  integrations.get(req.params.integration, function(e, integration) {
    if (e) {
      console.error(e);
      return res.end();
    }
    integration.transform(req, function(e, transformed) {
      if (e) {
        console.error(e);
        return res.end();
      }
      io.sockets.emit(req.params.token, transformed);
      res.end();
    });
  });
});

io.sockets.on('connection', function(socket) {
  if (process.env.HEROKU === 'true') {
    io.set("transports", ["xhr-polling"]);
    io.set("polling duration", 10);
  }
//  console.log('connected socket', socket);
});<commit_msg>moved transports out of connect<commit_after>var content = require('./lib/content'),
  fs = require('fs'),
  integrations = require('./integrations/integrations'),
  router = require('router')(),
  server = require('http').Server(),
  io = require('socket.io')(server);

var port = process.env.PORT || 8000;

if (process.env.HEROKU === 'true') {
  console.log('available transports', io.engine.transports);
  io.set("transports", ["xhr-polling"]);
  io.set("polling duration", 10);
}

server.on('request', router);
server.listen(port);

console.log('Server running on ' + port);

router.get('/', content.static('index.html'));
router.get('/index.js', content.static('index.js'));
router.get('/styles.css', content.static('styles.css'));

router.post('/integration/{integration}/{token}', function(req, res) {
  integrations.get(req.params.integration, function(e, integration) {
    if (e) {
      console.error(e);
      return res.end();
    }
    integration.transform(req, function(e, transformed) {
      if (e) {
        console.error(e);
        return res.end();
      }
      io.sockets.emit(req.params.token, transformed);
      res.end();
    });
  });
});

io.sockets.on('connection', function(socket) {
  //  console.log('connected socket', socket);
});
{'fraction_non_alphanumeric': 0.20626525630593978, 'fraction_numerical': 0.004882017900732303, 'mean_word_length': 3.9377510040160644, 'pattern_counts': {'":': 0, '<': 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': '4449486', 'n_tokens_mistral': 794, 'n_tokens_neox': 779, 'n_words': 137}