Added openvidu-browser exception events to tutorials

This commit is contained in:
csantosm 2021-05-06 17:33:03 +02:00
parent 7f228075af
commit 25c9e3c30d
18 changed files with 92 additions and 3 deletions

View File

@ -64,6 +64,11 @@ function joinSession() {
removeUserData(event.stream.connection);
});
// On every asynchronous exception...
session.on('exception', (exception) => {
console.warn(exception);
});
// --- 4) Connect to the session with a valid user token ---
// 'getToken' method is simulating what your server-side should do.

View File

@ -63,6 +63,11 @@ function joinRoom() {
updateLayout();
});
// On every asynchronous exception...
session.on('exception', (exception) => {
console.warn(exception);
});
// --- 4) Connect to the session with a valid user token ---

View File

@ -17,6 +17,11 @@ function joinSession() {
}
});
// On every asynchronous exception...
session.on('exception', (exception) => {
console.warn(exception);
});
getToken(mySessionId).then(token => {
session.connect(token)

View File

@ -72,6 +72,11 @@ export class AppComponent implements OnDestroy {
this.deleteSubscriber(event.stream.streamManager);
});
// On every asynchronous exception...
this.session.on('exception', (exception) => {
console.warn(exception);
});
// --- 4) Connect to the session with a valid user token ---
// 'getToken' method is simulating what your server-side should do.

View File

@ -40,6 +40,11 @@ function joinSession() {
removeUserData(event.stream.connection);
});
// On every asynchronous exception...
session.on('exception', (exception) => {
console.warn(exception);
});
// --- 4) Connect to the session with a valid user token ---

View File

@ -109,6 +109,11 @@ class App extends Component {
this.deleteSubscriber(event.stream.streamManager);
});
// On every asynchronous exception...
mySession.on('exception', (exception) => {
console.warn(exception);
});
// --- 4) Connect to the session with a valid user token ---
// 'getToken' method is simulating what your server-side should do.

View File

@ -90,6 +90,11 @@ export default {
}
});
// On every asynchronous exception...
this.session.on('exception', ({ exception }) => {
console.warn(exception);
});
// --- Connect to the session with a valid user token ---
// 'getToken' method is simulating what your server-side should do.

View File

@ -93,6 +93,11 @@ export class AppComponent implements OnDestroy {
this.deleteSubscriber(event.stream.streamManager);
});
// On every asynchronous exception...
this.session.on('exception', (exception) => {
console.warn(exception);
});
// --- 4) Connect to the session with a valid user token ---
// 'getToken' method is simulating what your server-side should do.

View File

@ -93,6 +93,11 @@ export class AppComponent implements OnDestroy {
this.deleteSubscriber(event.stream.streamManager);
});
// On every asynchronous exception...
this.session.on('exception', (exception) => {
console.warn(exception);
});
// --- 4) Connect to the session with a valid user token ---
// 'getToken' method is simulating what your server-side should do.

View File

@ -86,6 +86,11 @@
});
});
// On every asynchronous exception...
session.on('exception', (exception) => {
console.warn(exception);
});
// Connect to session. We will receive all necessary events when success
session.connect(token)
.catch(error => {

View File

@ -41,6 +41,11 @@ function joinSession() {
removeUserData(event.stream.connection);
});
// On every asynchronous exception...
session.on('exception', (exception) => {
console.warn(exception);
});
// --- 4) Connect to the session passing the retrieved token and some more data from
// the client (in this case a JSON with the nickname chosen by the user) ---
@ -177,7 +182,7 @@ function removeUser() {
httpPostRequest(
'api-sessions/remove-user',
{sessionName: sessionName, token: token},
'User couldn\'t be removed from session',
'User couldn\'t be removed from session',
(response) => {
console.warn("You have been removed from session " + sessionName);
}

View File

@ -41,9 +41,14 @@ function joinSession() {
removeUserData(event.stream.connection);
});
// On every asynchronous exception...
session.on('exception', (exception) => {
console.warn(exception);
});
// --- 4) Connect to the session passing the retrieved token and some more data from
// the client (in this case a JSON with the nickname chosen by the user) ---
var nickName = $("#nickName").val();
session.connect(token, { clientData: nickName })
.then(() => {
@ -177,7 +182,7 @@ function removeUser() {
httpPostRequest(
'api-sessions/remove-user',
{sessionName: sessionName, token: token},
'User couldn\'t be removed from session',
'User couldn\'t be removed from session',
(response) => {
console.warn("You have been removed from session " + sessionName);
}

View File

@ -109,6 +109,11 @@
removeUserData(event.stream.connection);
});
// On every asynchronous exception...
session.on('exception', (exception) => {
console.warn(exception);
});
// --- 4) Connect to the session passing the retrieved token and some more data from
// the client (in this case a JSON with the nickname chosen by the user) ---

View File

@ -108,6 +108,11 @@
removeUserData(event.stream.connection);
});
// On every asynchronous exception...
session.on('exception', (exception) => {
console.warn(exception);
});
// --- 4) Connect to the session passing the retrieved token and some more data from
// the client (in this case a JSON with the nickname chosen by the user) ---

View File

@ -132,6 +132,11 @@ export default class App extends Component<Props> {
this.deleteSubscriber(event.stream);
});
// On every asynchronous exception...
mySession.on('exception', (exception) => {
console.warn(exception);
});
// --- 4) Connect to the session with a valid user token ---
// 'getToken' method is simulating what your server-side should do.
// 'token' parameter should be retrieved and returned by your own backend

View File

@ -82,6 +82,11 @@ function joinSession() {
pushEvent(event);
});
// On every asynchronous exception...
session.on('exception', (exception) => {
console.warn(exception);
});
// --- 4) Connect to the session passing the retrieved token and some more data from
// the client (in this case a JSON with the nickname chosen by the user) ---

View File

@ -82,6 +82,11 @@ function joinSession() {
pushEvent(event);
});
// On every asynchronous exception...
session.on('exception', (exception) => {
console.warn(exception);
});
// --- 4) Connect to the session passing the retrieved token and some more data from
// the client (in this case a JSON with the nickname chosen by the user) ---

View File

@ -31,6 +31,10 @@ $(document).ready(() => {
form.style.display = 'block';
webComponent.style.display = 'none';
});
session.on('exception', (exception) => {
console.warn(exception);
});
});
webComponent.addEventListener('publisherCreated', (event) => {