<commit_before>/*
NodeJS Chat Relay
*/

var ChatRelay = {
	ready: false,
	I: {
		ws: require('ws')
	},
	
	WS: {
		wss: null,
		init: function() {
			var WebSocketServer = ChatRelay.I.ws.Server;
			ChatRelay.WS.wss = new WebSocketServer({port: (process.env.PORT || 5000)});
			console.log("Starting WS Server on port " + (process.env.PORT || 5000));
			ChatRelay.WS.wss.on('connection', function connection(ws) {
				ws.on('message', function incoming(msg) {
					console.log("WS msg: " + msg);
					if(ChatRelay.ready)
						ChatRelay.WS.wss.broadcast(msg);
				});
				if(ChatRelay.ready)
					ws.send("Connected");
				else
					ws.send("Wait");
			});
			ChatRelay.WS.wss.broadcast = function broadcast(data) {
				ChatRelay.WS.wss.clients.forEach(function each(client) {
					client.send(data);
				});
			}
		}
	},
	
	init: function() {
		ChatRelay.WS.init();
		
		console.log("ChatRelay ready");
		ChatRelay.ready = true;
	}
};

ChatRelay.init();

/*----------------------------------------------------------------*/

console.log('Attempting to start webserver');
var express = require('express');
var app = express();

app.set('port', (/*process.env.PORT || */5000));

app.use(express.static(__dirname + '/public'));

// views is directory for all template files
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');

app.get('/', function(request, response) {
  response.render('pages/index');
});

app.listen(app.get('port'), function() {
  console.log('Webserver running on port ', app.get('port'));
});


<commit_msg>Commented out WS part<commit_after>/*
NodeJS Chat Relay
*/
/*
var ChatRelay = {
	ready: false,
	I: {
		ws: require('ws')
	},
	
	WS: {
		wss: null,
		init: function() {
			var WebSocketServer = ChatRelay.I.ws.Server;
			ChatRelay.WS.wss = new WebSocketServer({port: (process.env.PORT || 5000)});
			console.log("Starting WS Server on port " + (process.env.PORT || 5000));
			ChatRelay.WS.wss.on('connection', function connection(ws) {
				ws.on('message', function incoming(msg) {
					console.log("WS msg: " + msg);
					if(ChatRelay.ready)
						ChatRelay.WS.wss.broadcast(msg);
				});
				if(ChatRelay.ready)
					ws.send("Connected");
				else
					ws.send("Wait");
			});
			ChatRelay.WS.wss.broadcast = function broadcast(data) {
				ChatRelay.WS.wss.clients.forEach(function each(client) {
					client.send(data);
				});
			}
		}
	},
	
	init: function() {
		ChatRelay.WS.init();
		
		console.log("ChatRelay ready");
		ChatRelay.ready = true;
	}
};

ChatRelay.init();

/*----------------------------------------------------------------*/

console.log('Attempting to start webserver');
var express = require('express');
var app = express();

app.set('port', (process.env.PORT || 5000));

app.use(express.static(__dirname + '/public'));

// views is directory for all template files
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');

app.get('/', function(request, response) {
  response.render('pages/index');
});

app.listen(app.get('port'), function() {
  console.log('Webserver running on port ', app.get('port'));
});



{'fraction_non_alphanumeric': 0.22416020671834624, 'fraction_numerical': 0.007751937984496124, 'mean_word_length': 3.0064683053040104, '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': '3458295', 'n_tokens_mistral': 1218, 'n_tokens_neox': 1042, 'n_words': 201}