Skip to content

Commit

Permalink
Fixed #201
Browse files Browse the repository at this point in the history
  • Loading branch information
muaz-khan committed Jul 24, 2016
1 parent 82207b9 commit 978d0a5
Show file tree
Hide file tree
Showing 10 changed files with 305 additions and 165 deletions.
6 changes: 5 additions & 1 deletion RTCMultiConnection.js
@@ -1,4 +1,4 @@
// Last time updated: 2016-07-15 1:32:16 PM UTC
// Last time updated: 2016-07-24 8:06:16 AM UTC

// _____________________
// RTCMultiConnection-v3
Expand Down Expand Up @@ -1497,6 +1497,10 @@
parameters += '&maxRelayLimitPerUser=' + (connection.maxRelayLimitPerUser || 2);
}

if (connection.socketCustomParameters) {
parameters += connection.socketCustomParameters;
}

try {
io.sockets = {};
} catch (e) {};
Expand Down
8 changes: 4 additions & 4 deletions RTCMultiConnection.min.js

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions demos/index.html
Expand Up @@ -3,11 +3,6 @@

<head>
<meta name="google-site-verification" content="zhJ273gZGLJ_Cbl-muzPYYTR6jD7sCCgufDIRS5h4SE" />
<script>
if(location.protocol === 'http:') {
location.href = location.href.replace(location.protocol, 'https:');
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<link rel="stylesheet" href="https://cdn.webrtc-experiment.com/style.css">
Expand Down
4 changes: 4 additions & 0 deletions dev/SocketConnection.js
Expand Up @@ -10,6 +10,10 @@ function SocketConnection(connection, connectCallback) {
parameters += '&maxRelayLimitPerUser=' + (connection.maxRelayLimitPerUser || 2);
}

if (connection.socketCustomParameters) {
parameters += connection.socketCustomParameters;
}

try {
io.sockets = {};
} catch (e) {};
Expand Down
2 changes: 1 addition & 1 deletion dist/rmc3.fbr.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion dist/rmc3.js
@@ -1,4 +1,4 @@
// Last time updated: 2016-07-15 1:32:16 PM UTC
// Last time updated: 2016-07-24 8:06:16 AM UTC

// _____________________
// RTCMultiConnection-v3
Expand Down Expand Up @@ -1497,6 +1497,10 @@
parameters += '&maxRelayLimitPerUser=' + (connection.maxRelayLimitPerUser || 2);
}

if (connection.socketCustomParameters) {
parameters += connection.socketCustomParameters;
}

try {
io.sockets = {};
} catch (e) {};
Expand Down
8 changes: 4 additions & 4 deletions dist/rmc3.min.js

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions docs/api.md
Expand Up @@ -2,6 +2,47 @@

> RTCMultiConnection v3 API References
### `socketURL`

1. You can run nodejs on a separate domain or separate port or on a separate server
2. You can set `socketURL="ip-address"` to link nodejs server
3. Now you can run RTCMultiConnection-v3 demos on any webpage; whether it is PHP page, ASP.net page, python or ruby page or whatever framework running top over HTML.

```javascript
connection.socketURL = 'https://onlyChangingPort.com:8888/';
connection.socketURL = 'https://separateDomain.com:443/';
connection.socketURL = '/'; // same domain

// or a free signaling server
connection.socketURL = 'https://rtcmulticonnection.herokuapp.com:443/';
```

### `socketCustomParameters`

You can pass your custom socket.io parameters as well:

```javascript
// starts with "&"
// &fullName=Muaz
// &meetingId=xyz
connection.socketCustomParameters = '&fullName=Muaz&country=PK&meetingId=xyz';
```

Now you can open `server.js` and access above parameters here:

```javascript
// you can find below line on "server.js" file
require('./Signaling-Server.js')(app, function(socket) {
var params = socket.handshake.query;

var meetingId = params.meetingId;
var fullName = params.fullName;
var country = params.country;
var userid = params.userid;
// etc.
});
```

### `applyConstraints`

This method allows you change video resolutions or audio sources without making a new getUserMedia request i.e. it modifies your existing MediaStream:
Expand Down
9 changes: 7 additions & 2 deletions server.js
Expand Up @@ -2,7 +2,7 @@
// MIT License - www.WebRTC-Experiment.com/licence
// Documentation - github.com/muaz-khan/RTCMultiConnection

var isUseHTTPs = !(!!process.env.PORT || !!process.env.IP);
var isUseHTTPs = false && !(!!process.env.PORT || !!process.env.IP);

var port = process.env.PORT || 9001;

Expand Down Expand Up @@ -116,7 +116,12 @@ if (isUseHTTPs) {

app = app.listen(port, process.env.IP || '0.0.0.0', function() {
var addr = app.address();
console.log('Server listening at', addr.address + ':' + addr.port);

if (addr.address === '0.0.0.0') {
addr.address = 'localhost';
}

console.log('Server listening at ' + (isUseHTTPs ? 'https' : 'http') + '://' + addr.address + ':' + addr.port);
});

require('./Signaling-Server.js')(app, function(socket) {
Expand Down

0 comments on commit 978d0a5

Please sign in to comment.