Improve the server so that both protocol (WebSocket and WebRTC) can use the same port

This commit is contained in:
Yann Flory
2016-03-16 16:34:27 +01:00
parent 7ee75b9e7f
commit c7d190f1c0
4 changed files with 14 additions and 31 deletions

View File

@@ -157,6 +157,7 @@ let run = module.exports.run = function (storage, socketServer) {
});
}, 5000);
socketServer.on('connection', function(socket) {
if(socket.upgradeReq.url !== '/cryptpad_websocket') { return; }
let conn = socket.upgradeReq.connection;
let user = {
addr: conn.remoteAddress + '|' + conn.remotePort,