This commit is contained in:
barwie2@st.amu.edu.pl 2020-03-08 17:21:10 +01:00
parent b0285bf1bd
commit b329b5965d

View File

@ -1,5 +1,5 @@
const WebSocket = require('ws'); const WebSocket = require('ws');
var http = require('http'); var https = require('https');
var websocket_port = 8888; var websocket_port = 8888;
const wss = new WebSocket.Server({port: websocket_port}); const wss = new WebSocket.Server({port: websocket_port});
@ -11,7 +11,7 @@ wss.on('connection', function connection(ws) {
lookup[ws.protocol] = ws; lookup[ws.protocol] = ws;
}); });
var server = http.createServer(function (request, response) { var server = https.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text\plain"}); response.writeHead(200, {"Content-Type": "text\plain"});
request.setEncoding('utf8'); request.setEncoding('utf8');
@ -41,6 +41,6 @@ var server = http.createServer(function (request, response) {
} }
}); });
var http_port = 8889; var https_port = 8889;
server.listen(http_port); server.listen(https_port);
console.log("HTTP server running on port " + http_port); console.log("HTTPS server running on port " + https_port);