<commit_before>'use strict';
var util = require('util');
var fs = require('fs');
var EventEmitter = require('events').EventEmitter;

function Server() {
	EventEmitter.call(this);
	this.packet = new Buffer([0x01, 0x00, 0x00, 0x00]);
	this.connections = [];
}

util.inherits(Server, EventEmitter);

Server.prototype.open = function(logger) {
	var WebSocketServer = require('../websocket').server;
	// var http = require('https');
	var http = require('http');
	var PORT = 23518;
	var self = this;

	var appPath = 'app';
	if(NODE_ENV === 'production') {
		appPath = 'resources/app.asar';
	}
	
	// var httpServer = http.createServer({
	//     key: fs.readFileSync('./' + appPath + '/ssl/localhost_key.pem'),
	//     cert: fs.readFileSync('./' + appPath + '/ssl/localhost_cert.pem'),
	//     ca: fs.readFileSync('./' + appPath + '/ssl/localhost_ca.pem')
	// });
	var httpServer = http.createServer(function(request, response) {
		response.writeHead(404);
		response.end();
	});
	self.httpServer = httpServer;
	httpServer.listen(PORT, function() {
		if(logger) {
			logger.i('Listening on port ' + PORT);
		}
	});

	var server = new WebSocketServer({
		httpServer: httpServer,
		autoAcceptConnections: false
	});
	self.server = server;
	server.on('request', function(request) {
		var connection = request.accept();
		self.connections.push(connection);
		if(logger) {
			logger.i('Entry connected.');
		}
		
		connection.on('message', function(message) {<commit_msg>소켓 통신 tls적용.<commit_after>'use strict';
var util = require('util');
var fs = require('fs');
var EventEmitter = require('events').EventEmitter;

function Server() {
	EventEmitter.call(this);
	this.packet = new Buffer([0x01, 0x00, 0x00, 0x00]);
	this.connections = [];
}

util.inherits(Server, EventEmitter);

Server.prototype.open = function(logger) {
	var WebSocketServer = require('../websocket').server;
	// var http = require('https');
	var http;
	var PORT = 23518;
	var self = this;
	var httpServer;
	// var appPath = 'app';
	// if(NODE_ENV === 'production') {
	// 	appPath = 'resources/app.asar';
	// }
	
	if(fs.existsSync(path.resolve(global.__dirname, 'ssl', 'cert.pem'))) {
		http = require('https');
		httpServer = http.createServer({
		    key: fs.readFileSync(path.resolve(global.__dirname, 'ssl', 'hardware.play-entry.key')),
		    cert: fs.readFileSync(path.resolve(global.__dirname, 'ssl', 'cert.pem')),
		    ca: fs.readFileSync(path.resolve(global.__dirname, 'ssl', 'Symantec-Chain_sha2.pem'))
		});
	} else {
		http = require('http');
		httpServer = http.createServer(function(request, response) {
			response.writeHead(404);
			response.end();
		});
	}

	self.httpServer = httpServer;
	httpServer.listen(PORT, function() {
		if(logger) {
			logger.i('Listening on port ' + PORT);
		}
	});

	var server = new WebSocketServer({
		httpServer: httpServer,
		autoAcceptConnections: false
	});
	self.server = server;
	server.on('request', function(request) {
		var connection = request.accept();
		self.connections.push(connection);
		if(logger) {
			logger.i('Entry connected.');
		}
		
		connection.on('message', function(message) {
{'fraction_non_alphanumeric': 0.17719072164948454, 'fraction_numerical': 0.013208762886597938, 'mean_word_length': 4.236087689713322, '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': '5375850', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1059, 'n_words': 205}