openvidu-browser: fix log for getRemoteConnection

pull/630/head
pabloFuente 2021-05-28 10:39:19 +02:00
parent d320da622c
commit b4c6c2b4a7
1 changed files with 6 additions and 7 deletions

View File

@ -781,7 +781,7 @@ export class Session extends EventDispatcher {
onParticipantLeft(msg): void { onParticipantLeft(msg): void {
if (this.remoteConnections.size > 0) { if (this.remoteConnections.size > 0) {
this.getRemoteConnection(msg.connectionId).then(connection => { this.getRemoteConnection(msg.connectionId, 'onParticipantLeft').then(connection => {
if (!!connection.stream) { if (!!connection.stream) {
const stream = connection.stream; const stream = connection.stream;
@ -823,7 +823,7 @@ export class Session extends EventDispatcher {
// Get the existing Connection created on 'onParticipantJoined' for // Get the existing Connection created on 'onParticipantJoined' for
// existing participants or create a new one for new participants // existing participants or create a new one for new participants
let connection: Connection; let connection: Connection;
this.getRemoteConnection(response.id) this.getRemoteConnection(response.id, 'onParticipantPublished')
.then(con => { .then(con => {
// Update existing Connection // Update existing Connection
@ -848,7 +848,7 @@ export class Session extends EventDispatcher {
// Your stream has been forcedly unpublished from the session // Your stream has been forcedly unpublished from the session
this.stopPublisherStream(msg.reason); this.stopPublisherStream(msg.reason);
} else { } else {
this.getRemoteConnection(msg.connectionId) this.getRemoteConnection(msg.connectionId, 'onParticipantUnpublished')
.then(connection => { .then(connection => {
@ -965,7 +965,7 @@ export class Session extends EventDispatcher {
// Your stream has been forcedly changed (filter feature) // Your stream has been forcedly changed (filter feature)
callback(this.connection); callback(this.connection);
} else { } else {
this.getRemoteConnection(msg.connectionId) this.getRemoteConnection(msg.connectionId, 'onStreamPropertyChanged')
.then(connection => { .then(connection => {
callback(connection); callback(connection);
}) })
@ -1411,7 +1411,7 @@ export class Session extends EventDispatcher {
}); });
} }
private getRemoteConnection(connectionId: string): Promise<Connection> { private getRemoteConnection(connectionId: string, operation: string): Promise<Connection> {
return new Promise<Connection>((resolve, reject) => { return new Promise<Connection>((resolve, reject) => {
const connection = this.remoteConnections.get(connectionId); const connection = this.remoteConnections.get(connectionId);
if (!!connection) { if (!!connection) {
@ -1419,9 +1419,8 @@ export class Session extends EventDispatcher {
resolve(connection); resolve(connection);
} else { } else {
// Remote connection not found. Reject with OpenViduError // Remote connection not found. Reject with OpenViduError
const errorMessage = 'Remote connection ' + connectionId + " unknown when 'onParticipantLeft'. " + const errorMessage = 'Remote connection ' + connectionId + " unknown when '" + operation + "'. " +
'Existing remote connections: ' + JSON.stringify(this.remoteConnections.keys()); 'Existing remote connections: ' + JSON.stringify(this.remoteConnections.keys());
reject(new OpenViduError(OpenViduErrorName.GENERIC_ERROR, errorMessage)); reject(new OpenViduError(OpenViduErrorName.GENERIC_ERROR, errorMessage));
} }
}); });