https post

This commit is contained in:
barwie2@st.amu.edu.pl 2020-03-09 19:38:01 +01:00
parent 37e994d6d1
commit 79280743d8

View File

@ -1,5 +1,5 @@
const WebSocket = require('ws'); const WebSocket = require('ws');
var https = require('https'); var http = require('http');
const fs = require('fs'); const fs = require('fs');
var websocket_port = 8888; var websocket_port = 8888;
@ -12,11 +12,11 @@ wss.on('connection', function connection(ws) {
console.log(ws); console.log(ws);
lookup[ws.protocol] = ws; lookup[ws.protocol] = ws;
}); });
/*{
var server = https.createServer({ cert: fs.readFileSync('/etc/letsencrypt/live/atcheck.projektstudencki.pl/cert.pem'),
cert: fs.readFileSync('/etc/letsencrypt/live/atcheck.projektstudencki.pl/cert.pem'), key: fs.readFileSync('/etc/letsencrypt/live/atcheck.projektstudencki.pl/privkey.pem')
key: fs.readFileSync('/etc/letsencrypt/live/atcheck.projektstudencki.pl/privkey.pem') }, */
}, function (request, response) { var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text\plain"}); response.writeHead(200, {"Content-Type": "text\plain"});
request.setEncoding('utf8'); request.setEncoding('utf8');
@ -46,6 +46,6 @@ var server = https.createServer({
} }
}); });
var https_port = 8889; var http_port = 8889;
server.listen(https_port); server.listen(http_port);
console.log("HTTP server running on port " + https_port); console.log("HTTP server running on port " + http_port);