-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with socket.io #685
Comments
Modify Оpened port 9001, 80, 443 on the server. How to check if server is running correctly? via https://github.com/muaz-khan/RTCMultiConnection/blob/master/docs/installation-guide.md |
git clone https://github.com/muaz-khan/RTCMultiConnection-Server.git ./RTCMultiConnection-Server
cd RTCMultiConnection-Server
mkdir node_modules
npm install
vi config.json and config.json: {
"socketURL": "/",
"dirPath": "",
"homePage": "/demos/index.html",
"socketMessageEvent": "RTCMultiConnection-Message",
"socketCustomEvent": "RTCMultiConnection-Custom-Message",
"port": "9001",
"enableLogs": "false",
"autoRebootServerOnFailure": "false",
"isUseHTTPs": "true",
"sslKey": "./fake-keys/privatekey.pem",
"sslCert": "./fake-keys/certificate.pem",
"sslCabundle": "",
"enableAdmin": "false",
"adminUserName": "username",
"adminPassword": "password"
} Please make sure to pass valid keys for Now run the server: node server Now open this: https://rtctestserver.doxx.de:9001/socket.io/socket.io.js Did not load the file? iptables -I INPUT 1 -i eth0 -p tcp --dport 9001 -j ACCEPT Run server.js again. Now, are you facing SSL issues? You can install certificate using letsencrypt: sudo -s
apt-get install software-properties-common
add-apt-repository ppa:certbot/certbot
apt-get update
apt-get install python-certbot-apache
certbot --apache
certbot renew --dry-run Now config.json looks like this: {
"socketURL": "/",
"dirPath": "",
"homePage": "/demos/index.html",
"socketMessageEvent": "RTCMultiConnection-Message",
"socketCustomEvent": "RTCMultiConnection-Custom-Message",
"port": "9001",
"enableLogs": "false",
"autoRebootServerOnFailure": "false",
"isUseHTTPs": "true",
"sslKey": "/etc/letsencrypt/live/rtctestserver.doxx.de/privkey.pem",
"sslCert": "/etc/letsencrypt/live/rtctestserver.doxx.de/fullchain.pem",
"sslCabundle": "",
"enableAdmin": "false",
"adminUserName": "username",
"adminPassword": "password"
} Now run the server: node server Now open this: https://rtctestserver.doxx.de:9001/socket.io/socket.io.js You can use pm2 to run server in background, only if all above steps are successful. pm2 startup
pm2 start server.js
pm2 save Now copy any demo from demos directory: For example this demo: Press Now your main website can upload and run this demo: https://rtctestserver.doxx.de/Video-Conferencing.html In simple words, port 9001 is used for socket.io and port 443 is used for main website. You can run PHP or Python or any server on port 443. It is possible to run nodejs on port 443 however personally I prefer PHP. Here is an example for you:
|
Hello Muaz, Thanks on very fast response. We do everthing as you did suggest, but it look can not load Socket.IO https://ananym:9001/socket.io/socket.io.js Very strange. Also we put our configuration: Can you suggest any other help so we can figure out what is problem. Thanks Nenad |
Possibilities:
In the first comment, you wrote that when you run server.js, you get this: Socket.io is listening at:
https://rtctestserver.doxx.de:9001
Your web-browser (HTML file) MUST set this line:
connection.socketURL = "https://rtctestserver.doxx.de:9001";
For more help: node server.js --help Do you still get same output when you run the server.js file? |
Hi Muaz When i run server node server.js I get next msg in command line: Socket.io is listening at: https://localhost:9001/ Your web-browser (HTML file) MUST set this line: connection.socketURL = "https://localhost:9001/"; When run url from browser: https://ananym:9001/socket.io/socket.io.js I am getting next error: This site can’t be reached ananym took too long to respond. Try: Checking the connection Checking the proxy and the firewall Running Windows Network Diagnostics ERR_CONNECTION_TIMED_OUT Also i have additional question(which could make me confusion): How to node server.js run like https://ananym:9001/. Now It's run by default localhost like https://localhost:9001:/ |
@muaz-khan I am facing the exact same issue. I have cross checked all the possibilities you have mention I have hosted this application on nginx server below is the site file structure and node server is running using systemd
I have followed below link to the host application on nginx server |
I found this, here: location ~* \.io {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:443;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
} |
1.Why there are rtcmulticonnection and rtcmulticonnection-server, which one should I use? |
I need very simple http/https demo running on localhost, does anyone help? |
Sir |
I don't want to revive an old thread but I'm also having the same issue here. import io from 'socket.io-client'; and it works fine as long as I'm joining the room with local stream const constraints = {
audio: false, // Disable audio capture
video: false, // Disable video capture
}; with this constraint attached to joinOrOpen, it gives me "callback is not defined" error at 4512 line. Thanks! |
Hello Muaz,
I am trying to test demo, but not work on server, only work in localhost.
socket.io.js:1 Failed to load resource: the server responded with a status of 404 ()
RTCMultiConnection.min.js:15 socket.io url is: https://ananym/
RTCMultiConnection.min.js:15 Uncaught ReferenceError: io is not defined
at new SocketConnection (RTCMultiConnection.min.js:15)
at connectSocket (RTCMultiConnection.min.js:17)
at RTCMultiConnection.connection.open (RTCMultiConnection.min.js:17)
at HTMLButtonElement.document.getElementById.onclick (Video-Conferencing.html:82)
In config.json:
{
"socketURL": "https://ananym:9001/",
"dirPath": "",
"homePage": "/demos/index.html",
"socketMessageEvent": "RTCMultiConnection-Message",
"socketCustomEvent": "RTCMultiConnection-Custom-Message",
"port": "9001",
"enableLogs": "true",
"autoRebootServerOnFailure": "false",
"isUseHTTPs": "true",
"sslKey": "./fake-keys/privatekey.pem",
"sslCert": "./fake-keys/certificate.pem",
"sslCabundle": "",
"enableAdmin": "false",
"adminUserName": "username",
"adminPassword": "password"
}
I am run server.js
Socket.io is listening at:
https://ananym:9001
Your web-browser (HTML file) MUST set this line:
connection.socketURL = "https://ananym:9001";
For more help: node server.js --help
How to run demo files on server. I think is problem with Socket.IO but not sure how to set up.
On localhost server with url http://localhost:9001 work fine but on server can not run video
The text was updated successfully, but these errors were encountered: