muaz-khan / rtcmulticonnection-server Goto Github PK
View Code? Open in Web Editor NEWRTCMultiConnection socket.io server (npm install rtcmulticonnection-server)
Home Page: https://muazkhan.com:9001/
License: MIT License
RTCMultiConnection socket.io server (npm install rtcmulticonnection-server)
Home Page: https://muazkhan.com:9001/
License: MIT License
Hi, where is the link for expressjs example? this link is 404
https://github.com/muaz-khan/RTCMultiConnection/tree/master/expressjs
Hello
i want the socket server which was working on https://webrtcweb.com:9001
if someone can help
it is old version
Hello dear community,
Hope I can find some help there. I'm actually working on a solution for internal tchat and this project seems to perfectly suits.
I did some research and worked a lot about my solution, but I'm actually facing a problem.
In fact, I did host my app on AWS Amplify and works fine (have interactions, tchat, share files, etc... while i used it on localhost and when I hosted the node server of @muaz-khan on heroku). But now I wanna have my server on AWS EC2, so I followed instructions (create a ec2 instances, create elastic ip for the instance, buy a domain name and clone my server on the ubuntu virtual machine , create certificates..) But when it arrives at the certificates, I have many problems.
Currently i'm lauching my node server correctly but I have problem with SSL and I'm not really attracted by network and stuff like that... I keep getting this error : ERR_SSL_VERSION_OR_CIPHER_MISMATCH
I did some research but... I'm not you know.. the type of guy that is really the job, so i'll be glad if I can find some help
I'm also dropping you my server code in order to have some review if I also did something wrong
Best Regards,
Sam
Hi, Muaz Khan
Thank you for your work. I hope for your help. I ran into a problem that is described below in the script. It is important that in my case the parameter connection.autoCloseEntireSession = true
Scenario:
connection.onleave
event is instantly triggered.connection.checkPresence
event indicates that the status of the room is open. Although there is no Initiator in it.What should be done so that the signal server quickly learns that the initiator went offline and then signal server closed the room?
Muaz, hello. Thanks for the update.
I installed rtcmulticonnection version ":" 3.5.7 "(rtcmulticonnection-server version" 1.2.9 "):
npm install --production
Then I fixed the config.json in which I activated the admin panel.
To use / admin / in the rtcmulticonnection folder, I manually install the "basic-auth" and "tsscmp" NPM packages:
npm install basic-auth
npm install tsscmp
Running node server.js
The https: //domenName/socket.io/socket.io.js Demo is loading.
At https: //domenName/admin/ the authorization is enabled, where I enter the administrator's login and password.
BUT! The admin page reloads very quickly.
Errors appear in the logs of the admin panel. In 1 second about 50 messages:
invalid-admin
Invalid username or password attempted
Without any UserName or Password
What could be the reason?
@muaz-khan @gbrian @nurassyl
can i use RTCMulticonnection without signal server on local network if i have all users ip on local file and i dont need stun and turn.
Hi i'm using yarn in projects. Normally i don't have any errors while using, but now i got this error while yarn add rtcmulticonnection
, [email protected]: The engine "node" is incompatible with this module. Expected version "latest". Got "13.11.0"
I think this depends on your packages.json because of this lines:
"engines": {
"node": "latest"
},
When I establish a RTCMulticonnection to peers using firefox,
peer connections gets lost with some of the peers with error message, but not with all.
Error is:
ice failed your turn server appears to be broken
Peer connection is closed between you &, state: failed.
The issue is only some peers hear me and not all.
Why does the error occur?
What is the way to reconnect to the peers with whom the peer connection is lost ?
can push to talk voice chat ?
thank for read.
I have a docker nginx symfony vue stack under exampledomain.com
I implemented RTCMulticonnection with
<script type="application/javascript" src="https://rtcmulticonnection.herokuapp.com/dist/RTCMultiConnection.min.js"></script>
<script type="application/javascript" src="https://rtcmulticonnection.herokuapp.com/socket.io/socket.io.js"></script>
and in my Vue File
this.rtcmConnection = new RTCMultiConnection();
this.rtcmConnection.socketURL = 'https://rtcmulticonnection.herokuapp.com:443/';
everything was working. Now i wanted to use my own signaling server. I started one with the following Dockerfile
FROM node
RUN git clone https://github.com/muaz-khan/RTCMultiConnection-Server \
&& cd RTCMultiConnection-Server \
&& npm install
CMD (cd RTCMultiConnection-Server && node server.js)
EXPOSE 9001
I modified config.json with the ssl configuration of my nginx server.
and in the server.js i make this changes:
var iooptions = {
allowUpgrades: true,
transports: ['polling', 'websocket' ],
cors: {
origin: ['https://www.exampledomain.com','https://exampledomain.com'],
credentials: true,
methods: 'GET'
}
};
ioServer(httpApp,iooptions).on('connection', function(socket) {
...
}
Now the server is up and running under
https://exampledomain.com:9001/
and used it in vue with:
this.rtcmConnection.socketURL = 'https://exampledomain.com:9001/';
the browser tries to connect with signaling server with get and post
https://exampledomain.com:9001/socket.io/?userid=ovdo1uhmxtj7l4p4fs&sessionid=1c7ec8af2eacf1cdc828a54abc72e85a&msgEvent=RTCMultiConnection-Message&socketCustomEvent=RTCMultiConnection-Custom-Message&autoCloseEntireSession=false&maxParticipantsAllowed=1000&extra={}&EIO=3&transport=polling&t=NOeBTVe
the get request seems to be okay
but the post request is a 400 bad request and returns a json bad handshake error.
How can I fix the error and connect?
Unsupported protocol
The client and server don't support a common SSL protocol version or cipher suite.
i want to run server in https mode to run it on another remote device
help me plz
Hello
I can't find the expressjs example @ https://github.com/muaz-khan/RTCMultiConnection/tree/master/expressjs
Uncaught TypeError: navigator.getUserMedia is not a function
at getUserMediaHandler (RTCMultiConnection.min.js:16:5245)
at RTCMultiConnection.connection.invokeGetUserMedia (RTCMultiConnection.min.js:18:8054)
at RTCMultiConnection.connection.getUserMedia.connection.captureUserMedia (RTCMultiConnection.min.js:17:31467)
at RTCMultiConnection.min.js:17:27046
at RTCMultiConnection.min.js:17:18061
at Socket. (RTCMultiConnection.min.js:15:7104)
at Socket.Emitter.emit (index.js:143:20)
at Socket.onconnect (socket.js:323:14)
at Socket.onpacket (socket.js:221:26)
at Manager.Emitter.emit (index.js:143:20)
No matter what php and javascript I use, nothing seems to work? I cannot upload the webm to the server?
save.php
`<?php
foreach(array('video', 'audio') as $type) {
if (isset(
echo 'uploads/';
$fileName = $_POST["${type}-filename"];
$uploadDirectory = 'uploads/'.$fileName;
if (!move_uploaded_file($_FILES["${type}-blob"]["tmp_name"], $uploadDirectory)) {
echo(" problem moving uploaded file");
}
echo($fileName);
}
}
?>
JavaScript code
var fileType = 'video'; // or "audio"
var fileName = 'ABCDEF.webm'; // or "wav"
var formData = new FormData();
formData.append(fileType + '-filename', fileName);
formData.append(fileType + '-blob', blob);
xhr('save.php', formData, function (fName) {
window.open(location.href + fName);
});
function xhr(url, data, callback) {
var request = new XMLHttpRequest();
request.onreadystatechange = function () {
if (request.readyState == 4 && request.status == 200) {
callback(location.href + request.responseText);
}
};
request.open('POST', url);
request.send(data);
}`
And my dev console has this:
RecordRTC version: 5.5.9
17:38:51.966 RecordRTC.js:63 started recording video stream.
17:38:51.967 RecordRTC.js:1057 Using recorderType: MediaStreamRecorder
17:38:51.968 RecordRTC.js:2104 Passing following config over MediaRecorder API. {type: "video", mimeType: "video/webm", checkForInactiveTracks: false, initCallback: ƒ}
17:38:51.969 RecordRTC.js:713 Recorder state changed: recording
17:38:51.969 RecordRTC.js:103 Initialized recorderType: MediaStreamRecorder for output-type: video
17:38:53.519 RecordRTC.js:129 Stopped recording video stream.
17:38:53.520 RecordRTC.js:713 Recorder state changed: stopped
17:38:53.522 RecordRTC.js:170 video/x-matroska;codecs=avc1,opus -> 121 KB
17:38:53.523 (index):347 POST url = save.php
17:38:53.696 (index):348 XHR finished loading: POST "https://bcast.mydomain.us/save.php".
xhr @ (index):348
(anonymous) @ (index):335
_callback @ RecordRTC.js:181
mediaRecorder.ondataavailable @ RecordRTC.js:2184
I get nothing in the uploads folder.
ideas?
this command i think it create a folder with name node_modules but npm install already do that
so i already have node_modules folder
the question do i need to have 2 folder with same name ?
I think the Server does not work with Socket IO Version3.
Request:
https://sss/socket.io/?userid=ddd&sessionid=ddd&msgEvent=RTCMultiConnection-Message&socketCustomEvent=RTCMultiConnection-Custom-Message&autoCloseEntireSession=true&maxParticipantsAllowed=1000&extra=%7B%7D&EIO=4&transport=polling&t=NM-5rDj
I am getting:
message: "Bad handshake method"
https://socket.io/docs/v3/migrating-from-2-x-to-3-0/index.html
Following the installation instructions in https://github.com/muaz-khan/RTCMultiConnection-Server/wiki#install-using-npm and then trying to run the simple demo:
<script src="https://rtcmulticonnection.herokuapp.com/dist/RTCMultiConnection.min.js"></script>
<script src="https://rtcmulticonnection.herokuapp.com/socket.io/socket.io.js"></script>
<script>
var connection = new RTCMultiConnection();
// this line is VERY_important
connection.socketURL = 'http://localhost:9001/';
// if you want audio+video conferencing
connection.session = {
audio: true,
video: true
};
connection.openOrJoin('test');
</script>
...does not work.
Hello,
We had an old server setup that ran RTCMultiConnection-Server on port 37022 and we proxypassed this through a domain using apache with following config:
RewriteCond %{QUERY_STRING} transport=polling [OR]
RewriteCond %{REQUEST_URI} /socket.io/socket.io.js
RewriteRule /socket.io/(.*)$ http://localhost:37022/socket.io/$1 [P]
ProxyPass /socket.io/ ws://localhost:37022/socket.io/
ProxyPassReverse /socket.io/ ws://localhost:37022/socket.io/
This is working. When we load the application we are seeing two requests to the IO server:
The first request replies with some text, 1:6
and the second establishes the socket connection and we can see messages back and forth.
We are now migrating to a nginx server that we need to replicate this on. We followed the instructions via the wiki but it doesn't seem to be working.
We are getting an error on the first request:
{"code":5,"message":"Unsupported protocol version"}
We think this is due to the first request needing to be a normal HTTP/S request and replying with the 1:6
data but instead nginx is attempting to upgrade this request to the socket.
We aren't sure how to configure NGINX. Does anyone have a working proxypass config for NGINX?
How to change url from localhost to domain.com
Thanks.
How we can use RTCMultiConnection in react native code?
we have successfully integrated it into the web but I m struggling with react native app.
is there anyone who has an idea or suggestion, so we can integrate it into react native?
Hello Muaz,
First-- Thank you very much for your project.
I was wondering if you might be able to help me set this server up with a reverse proxy on Nginx. I am using Let's encrypt certificates that auto-renew.
Am I able to run the RTCMultiConnection-server in HTTP, then load the certificates through nginx? Or do I have to specifically set the cert/key inside of the application in order to work in a production RTCMultiConnection (https) environment? I haven't been able to connect to socket.io this way. I was using a URL like https://server.com/signal/. Is that allowed, also?
Thank you for your time.
Mark
Hello,
I wanted to setup it on the IIS, Please help.
How can I install node on my server and run command to install node modules ( npm install )?
Thanks
I am trying to room this int a Express-server ant there are multiple issue . Fisrt all in all we have not a API docs for the server side with kind of method for use it . Second when i am initializing RTCMultiConnectionServer.addSocket(socket, config);
the` method don't return back nothing . Third did this: follow the Scalable-BroadCast i could took the index.js from nodeScript and adding direct the Scalable-BroadCast.js file directly to the express server just i took the local signaling but i am trying to take the remote i have not any idea where it is this part because direct in the RTCMultiConnection-Server it not inside . all the emit from socket are working very good but i can not make after the connection.onstream repply the REMOTE' type just i get the local because the sockets still inside of my angular's project
Hello,
Can one signaling server be used for 100s or thousands of connections?
How much bandwidth each connection consume on a continuous basis?
Is the signaling server used for discovery/signaling only or is it used as a relay server?
If I run my own signaling server then how can I check which signaling server is being used?
Thanks
when I install form git
npm install https://github.com/muaz-khan/RTCMultiConnection-Server.git ./
I got error :
notsup Unsupported engine for [email protected]: wanted: {"node":"latest"} (current: {"node":"13.11.0","npm":"6.13.7"})
notsup Not compatible with your version of node/npm: [email protected]
but I already upgrade my node to latest version . how to solve this ? thanks
How do you support us with commercial on more than 50 user connection on a same room. Please revert us back on the same.
Logs captured from Android device:
error snip:
Line 13230: 06-20 05:09:48.204 6604 6783 E chromium: [ERROR:ssl_client_socket_impl.cc(959)] handshake failed; returned -1, SSL error code 1, net_error -200
Line 13310: 06-20 05:09:48.324 6604 6783 E chromium: [ERROR:ssl_client_socket_impl.cc(959)] handshake failed; returned -1, SSL error code 1, net_error -200
Line 13311: 06-20 05:09:48.325 6604 6783 E chromium: [ERROR:ssl_client_socket_impl.cc(959)] handshake failed; returned -1, SSL error code 1, net_error -200
Line 13336: 06-20 05:09:48.434 6604 6783 E chromium: [ERROR:ssl_client_socket_impl.cc(959)] handshake failed; returned -1, SSL error code 1, net_error -200
Line 13348: 06-20 05:09:48.486 6604 6783 E chromium: [ERROR:ssl_client_socket_impl.cc(959)] handshake failed; returned -1, SSL error code 1, net_error -200
Line 13365: 06-20 05:09:48.550 7040 7273 E chromium: [ERROR:audio_rtp_receiver.cc(89)] AudioRtpReceiver::OnSetVolume: No audio channel exists.
Line 13371: 06-20 05:09:48.563 7040 7181 W chromium: [WARNING:timestamp_aligner.cc(131)] too short translated timestamp interval: system time (us) = 65490523, interval (us) = 58
Line 13372: 06-20 05:09:48.564 7040 7274 E chromium: [ERROR:internal_decoder_factory.cc(59)] Trying to create decoder for unsupported format
Line 13374: 06-20 05:09:48.567 7040 7274 E chromium: [ERROR:internal_decoder_factory.cc(59)] Trying to create decoder for unsupported format
I am writing a ios native app to establish connection to web. Can I use this signal server as my signal server? If so, how to establish a server?
There are strange moments in the work of the code.
In my case, the initiator has the parameters:
connection.autoCloseEntireSession = true
connection.userid = roomid
The script is very simple. Initiator refreshes the page. The server closes the room. The admin panel shows that the room is missing.
BUT! If the initiator tries to return and reopen the room, then RTCMultiConnection reports to the console that a user with that name already exists and gives him a new UserID
. At the same time, the admin panel shows that there are no rooms at all.
In my case, only restarting the server node server.js
or changing the name of the room helps.
What could it be?
Is this a bug or incorrect server installation?
I am able to record a Scalable Broadcast. However I cannot send the webm to the server. None of the PHP (save.php) are working for me. I am currently trying the following:
index.html
var fileType = 'video'; // or "audio"
var fileName = 'ABCDEF.webm'; // or "wav"
var formData = new FormData();
formData.append(fileType + '-filename', fileName);
formData.append(fileType + '-blob', blob);
xhr('save.php', formData, function (fName) {
// window.open(location.href + fName);
});
function xhr(url, data, callback) {
var request = new XMLHttpRequest();
request.onreadystatechange = function () {
if (request.readyState == 4 && request.status == 200) {
callback(location.href + request.responseText);
}
};
request.open('POST', url, true);
console.log(" POST url = ", url);
request.send(data);
}
save.php
Upload failed.'.$errstr.'
'; } function selfInvoker() { if (!isset($_POST['audio-filename']) && !isset($_POST['video-filename'])) { echo 'Empty file name.'; return; } // do NOT allow empty file names if (empty($_POST['audio-filename']) && empty($_POST['video-filename'])) { echo 'Empty file name.'; return; } // do NOT allow third party audio uploads if (false && isset($_POST['audio-filename']) && strrpos($_POST['audio-filename'], "RecordRTC-") !== 0) { echo 'File name must start with "RecordRTC-"'; return; } // do NOT allow third party video uploads if (false && isset($_POST['video-filename']) && strrpos($_POST['video-filename'], "RecordRTC-") !== 0) { echo 'File name must start with "RecordRTC-"'; return; } $fileName = ''; $tempName = ''; $file_idx = ''; if (!empty($_FILES['audio-blob'])) { $file_idx = 'audio-blob'; $fileName = $_POST['audio-filename']; $tempName = $_FILES[$file_idx]['tmp_name']; } else { $file_idx = 'video-blob'; $fileName = $_POST['video-filename']; $tempName = $_FILES[$file_idx]['tmp_name']; } if (empty($fileName) || empty($tempName)) { if(empty($tempName)) { echo 'Invalid temp_name: '.$tempName; return; } echo 'Invalid file name: '.$fileName; return; } /* $upload_max_filesize = return_bytes(ini_get('upload_max_filesize')); if ($_FILES[$file_idx]['size'] > $upload_max_filesize) { echo 'upload_max_filesize exceeded.'; return; } $post_max_size = return_bytes(ini_get('post_max_size')); if ($_FILES[$file_idx]['size'] > $post_max_size) { echo 'post_max_size exceeded.'; return; } */ $filePath = 'uploads/' . $fileName; // make sure that one can upload only allowed audio/video files $allowed = array( 'webm', 'wav', 'mp4', 'mkv', 'mp3', 'ogg' ); $extension = pathinfo($filePath, PATHINFO_EXTENSION); if (!$extension || empty($extension) || !in_array($extension, $allowed)) { echo 'Invalid file extension: '.$extension; return; } if (!move_uploaded_file($tempName, $filePath)) { if(!empty($_FILES["file"]["error"])) { $listOfErrors = array( '1' => 'The uploaded file exceeds the upload_max_filesize directive in php.ini.', '2' => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.', '3' => 'The uploaded file was only partially uploaded.', '4' => 'No file was uploaded.', '6' => 'Missing a temporary folder. Introduced in PHP 5.0.3.', '7' => 'Failed to write file to disk. Introduced in PHP 5.1.0.', '8' => 'A PHP extension stopped the file upload. PHP does not provide a way to ascertain which extension caused the file upload to stop; examining the list of loaded extensions with phpinfo() may help.' ); $error = $_FILES["file"]["error"]; if(!empty($listOfErrors[$error])) { echo $listOfErrors[$error]; } else { echo 'Not uploaded because of error #'.$_FILES["file"]["error"]; } } else { echo 'Problem saving file: '.$tempName; } return; } echo 'success'; } /* function return_bytes($val) { $val = trim($val); $last = strtolower($val[strlen($val)-1]); switch($last) { // The 'G' modifier is available since PHP 5.1.0 case 'g': $val *= 1024; case 'm': $val *= 1024; case 'k': $val *= 1024; } return $val; } */ selfInvoker(); ?>And my dev console I have:
RecordRTC version: 5.5.9
17:38:51.966 RecordRTC.js:63 started recording video stream.
17:38:51.967 RecordRTC.js:1057 Using recorderType: MediaStreamRecorder
17:38:51.968 RecordRTC.js:2104 Passing following config over MediaRecorder API. {type: "video", mimeType: "video/webm", checkForInactiveTracks: false, initCallback: ƒ}
17:38:51.969 RecordRTC.js:713 Recorder state changed: recording
17:38:51.969 RecordRTC.js:103 Initialized recorderType: MediaStreamRecorder for output-type: video
17:38:53.519 RecordRTC.js:129 Stopped recording video stream.
17:38:53.520 RecordRTC.js:713 Recorder state changed: stopped
17:38:53.522 RecordRTC.js:170 video/x-matroska;codecs=avc1,opus -> 121 KB
17:38:53.523 (index):347 POST url = save.php
The uploads folder is empty and I am not seeing any entries in the apache log file for PHP error?
Ideas?
Ray
In the admin panel there is a drop-down menu.
"There are new updates. Do you want to refresh? Auto update or Refresh"
I choose auto update
. After connecting or disconnecting a participants' from the room, in the admin panel the same menu appears again. It seems that auto update
doesn't remember my choice.
Muaz, today I decided to update the project. The server has started, but it is impossible to enter the administration panel. What could be the reason?
Installation Guide https://github.com/muaz-khan/RTCMultiConnection/blob/master/docs/installation-guide.md#install-using-npm-or-bower
sudo apt-get update
sudo apt-get upgrade
wget https://github.com/muaz-khan/RTCMultiConnection/archive/master.zip
unzip master.zip
cd RTCMultiConnection-master
npm install --production
Modify config.json
: homePage, port, sslKey, sslCert etc and "enableAdmin": "true"
.
And then run node server.js
Server is working fine. I can load https://domenName:443/socket.io/socket.io.js . Console log:
Socket.io is listening at:
https://localhost:443/
Your web-browser (HTML file) MUST set this line:
connection.socketURL = "https://localhost:443/";
Admin page is enabled and running on: https://localhost:443/admin/
Admin page username: adminuser
Admin page password: 34r34fv5gh56jh5jyh54er
For more help: node server.js --help
But when I try to go to the Admin page https://domenName:443/admin/ The server issues this message:
404 Not Found: Unexpected error.
isAdminAuthorized is not defined
ReferenceError: isAdminAuthorized is not defined
at /home/dd/videochat/RTCMultiConnection-master/server.js:80:13
at Server.serverHandler (/home/dd/videochat/RTCMultiConnection-master/node_modules/rtcmulticonnection-server/node_scripts/index.js:48:13)
at Server.<anonymous> (/home/dd/videochat/RTCMultiConnection-master/node_modules/engine.io/lib/server.js:471:22)
at Server.<anonymous> (/home/dd/videochat/RTCMultiConnection-master/node_modules/socket.io/lib/index.js:343:16)
at Server.emit (events.js:182:13)
at parserOnIncoming (_http_server.js:657:12)
at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)
Ubuntu 16.04.5 LTS
node -v
v11.0.0
nodejs -v
v10.13.0npm
npm -v
6.4.1
is it possible to do releases for the server side as well, so we know which versions are stable?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.