From 53e7e07f59065c7b14af3661e109518869c365e8 Mon Sep 17 00:00:00 2001 From: Miroslav Pejic Date: Fri, 17 Jun 2022 21:23:30 +0200 Subject: [PATCH] [mirotalk] - change port from .env --- .env.template | 4 ++++ .gitignore | 5 ++++- public/js/client.js | 17 +++-------------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.env.template b/.env.template index 37c58d23..27b78d7e 100644 --- a/.env.template +++ b/.env.template @@ -1,3 +1,7 @@ +# Signaling Server listen port + +PORT=3000 + # Ngrok # 1. Goto https://ngrok.com # 2. Get started for free diff --git a/.gitignore b/.gitignore index 8868e68a..80560587 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,7 @@ package-lock.json .cache # personal env -.env \ No newline at end of file +.env + +# personal doc +doc \ No newline at end of file diff --git a/public/js/client.js b/public/js/client.js index ce72224f..4b20687e 100644 --- a/public/js/client.js +++ b/public/js/client.js @@ -21,7 +21,6 @@ 'use strict'; // https://www.w3schools.com/js/js_strict.asp const isHttps = false; // must be the same on server.js -const signalingServerPort = 3000; // must be the same to server.js PORT const signalingServer = getSignalingServer(); const roomId = getRoomId(); const peerInfo = getPeerInfo(); @@ -535,16 +534,9 @@ function getPeerGeoLocation() { */ function getSignalingServer() { if (isHttps) { - return 'https://' + location.hostname + ':' + signalingServerPort; - // if need: change it with YOUR-SERVER-DOMAIN-NAME + return 'https://' + location.hostname; } - return ( - 'http' + - (location.hostname == 'localhost' ? '' : 's') + - '://' + - location.hostname + - (location.hostname == 'localhost' ? ':' + signalingServerPort : '') - ); + return 'http' + (location.hostname == 'localhost' ? '' : 's') + '://' + location.hostname; } /** @@ -650,12 +642,9 @@ function initClientPeer() { } console.log('Connecting to signaling server'); - //signalingSocket = io(signalingServer); // Disable the HTTP long-polling transport - signalingSocket = io(signalingServer, { - transports: ['websocket'], - }); + signalingSocket = io({ transports: ['websocket'] }); const transport = signalingSocket.io.engine.transport.name; // in most cases, "polling" console.log('Connection transport', transport);