https post

This commit is contained in:
barwie2@st.amu.edu.pl 2020-03-08 22:26:42 +01:00
parent e200410e51
commit f3765ccbaa

View File

@ -1,10 +1,14 @@
const WebSocket = require('ws'); const WebSocket = require('ws');
var https = require('https'); var https = require('https');
const fs = require('fs');
var websocket_port = 8888;
const wss = new WebSocket.Server({port: websocket_port});
console.log("Websocket server running on port " + websocket_port);
var lookup = []; var lookup = [];
wss.on('connection', function connection(ws) { wss.on('connection', function connection(ws) {
console.log(ws);
lookup[ws.protocol] = ws; lookup[ws.protocol] = ws;
}); });
@ -40,8 +44,7 @@ var server = https.createServer({
response.end("Undefined request ."); response.end("Undefined request .");
} }
}); });
var websocket_port = 8888;
const wss = new WebSocket.Server({port: websocket_port});
server.listen(websocket_port); var https_port = 8889;
console.log("HTTP server running on port " + websocket_port); server.listen(https_port);
console.log("HTTP server running on port " + https_port);