How to use the openvidu-node-client.OpenVidu function in openvidu-node-client

To help you get started, we’ve selected a few openvidu-node-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OpenVidu / openvidu-tutorials / openvidu-mvc-node / server.js View on Github external
user: "publisher2",
    pass: "pass",
    role: OpenViduRole.PUBLISHER
}, {
    user: "subscriber",
    pass: "pass",
    role: OpenViduRole.SUBSCRIBER
}];

// Environment variable: URL where our OpenVidu server is listening
var OPENVIDU_URL = process.argv[2];
// Environment variable: secret shared with our OpenVidu server
var OPENVIDU_SECRET = process.argv[3];

// Entrypoint to OpenVidu Node Client SDK
var OV = new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET);

// Collection to pair session names with OpenVidu Session objects
var mapSessions = {};
// Collection to pair session names with tokens
var mapSessionNamesTokens = {};

console.log("App listening on port 5000");

/* CONFIGURATION */



/* REST API */

app.post('/', loginController);
app.get('/', loginController);
github OpenVidu / openvidu-tutorials / openvidu-recording-node / server.js View on Github external
})); // Parse application/vnd.api+json as json

// Listen (start app with node server.js)
var options = {
    key: fs.readFileSync('openvidukey.pem'),
    cert: fs.readFileSync('openviducert.pem')
};
https.createServer(options, app).listen(5000);

// Environment variable: URL where our OpenVidu server is listening
var OPENVIDU_URL = process.argv[2];
// Environment variable: secret shared with our OpenVidu server
var OPENVIDU_SECRET = process.argv[3];

// Entrypoint to OpenVidu Node Client SDK
var OV = new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET);

// Collection to pair session names with OpenVidu Session objects
var mapSessions = {};
// Collection to pair session names with tokens
var mapSessionNamesTokens = {};

console.log("App listening on port 5000");




/* Session API */

// Get token (add new user to session)
app.post('/api/get-token', function (req, res) {
    // The video-call to connect
github OpenVidu / openvidu / openvidu-testapp / src / app / components / test-scenarios / test-scenarios.component.ts View on Github external
private getToken(): Promise {
    this.OV_NodeClient = new OpenViduAPI(this.openviduUrl, this.openviduSecret);
    if (!this.sessionProperties.customSessionId) {
      this.sessionProperties.customSessionId = this.fixedSessionId;
    }
    return this.OV_NodeClient.createSession(this.sessionProperties)
      .then(session_NodeClient => {
        return session_NodeClient.generateToken();
      });
  }
github OpenVidu / openvidu / openvidu-testapp / src / app / components / openvidu-instance / openvidu-instance.component.ts View on Github external
getToken(): Promise {
    const OV_NodeClient = new OpenViduAPI(this.openviduUrl, this.openviduSecret);
    if (!this.sessionProperties.customSessionId) {
      this.sessionProperties.customSessionId = this.sessionName;
    }
    return OV_NodeClient.createSession(this.sessionProperties)
      .then(session_NodeClient => {
        return session_NodeClient.generateToken();
      });
  }
github OpenVidu / openvidu / openvidu-testapp / src / app / components / openvidu-instance / openvidu-instance.component.ts View on Github external
openSessionApiDialog() {
    const dialogRef = this.dialog.open(SessionApiDialogComponent, {
      data: {
        openVidu: new OpenViduAPI(this.openviduUrl, this.openviduSecret),
        sessionId: !!this.session ? this.session.sessionId : this.sessionName
      },
      width: '280px'
    });

    dialogRef.afterClosed().subscribe((result: string) => {
      document.getElementById('session-api-btn').classList.remove('cdk-program-focused');
    });
  }
github OpenVidu / openvidu / openvidu-testapp / src / app / services / openvidu-rest.service.ts View on Github external
return new Promise((resolve, reject) => {
      const OV = new OpenViduAPI(openviduURL, openviduSecret);
      OV.createSession(sessionProperties)
        .then(session => {
          this.sessionIdSession.set(session.getSessionId(), session);
          this.sessionIdTokenOpenViduRole.set(session.getSessionId(), new Map());
          resolve(session.getSessionId());
        })
        .catch(error => {
          reject(error);
        });
    });
  }