Connection undefined when leaving failed room bug fixed

pull/20/head
pabloFuente 2017-06-09 15:21:53 +02:00
parent 8923d169f2
commit 1e046f80c0
4 changed files with 849 additions and 441 deletions

View File

@ -275,13 +275,13 @@ Whatever app you are developing, chances are you will need to pass some data for
- **API REST**: when asking for a token to */newToken*, you can pass data as third parameter in the BODY of the POST request
```
{“0”: “sessionId”, “1”: “role”, “2”: "DATA"}
{“session”: “sessionId”, “role”: “role”, “data”: "DATA"}
```
> **openvidu-backend-client** allows you to pass data when creating a Token object: </br>
> `Token t = new TokenOptions.Builder().data("DATA").build();`
The result will be that in all clients *Connection* objects will have in their *data* property the pertinent value you have provided for each user. So, an easy way to get the data associated to any user would be:
The result will be that in all clients, *Connection* objects will have in their *data* property the pertinent value you have provided for each user. So, an easy way to get the data associated to any user would be:
```javascript
session.on('streamCreated', function (event) {

File diff suppressed because one or more lines are too long

View File

@ -30,9 +30,11 @@ export class Session {
for (s of this.openVidu.openVidu.getRemoteStreams()) {
s.removeVideo();
}
if (this.connection) {
for (let streamId in this.connection.getStreams()) {
this.connection.getStreams()[streamId].removeVideo();
}
}
});
// Sets or updates the value of 'connection' property. Triggered by SessionInternal when succesful connection

View File

@ -40,7 +40,8 @@ export class OpenViduInternal {
checkNgrokUri() {
if (this.wsUri.indexOf(".ngrok.io") !== -1) {
// OpenVidu server URL referes to a ngrok IP: delete port of URL
// OpenVidu server URL referes to a ngrok IP: secure wss protocol and delete port of URL
this.wsUri = this.wsUri.replace("ws://", "wss://");
let regex = /\.ngrok\.io:\d+/;
this.wsUri = this.wsUri.replace(regex, ".ngrok.io");
} else if (this.wsUri.indexOf("localhost") !== -1) {