[WebService] Tokbox, Opentok Network Test
Opentok-network-test @ Github
create otNetworkTest object
// create
import OT from '@opentok/client';
import NetworkTest, { ErrorNames } from 'opentok-network-test-js';
const startNetWorkTest = async ({ timeoutSeconds = 10 }) => {
try {
const sessionInfo = {
apiKey: '123456', // Add the API key for your OpenTok project here.
sessionId: '1_MX40NzIwMzJ-fjE1MDElGQkJJfn4', // Add a test session ID for that project
token: 'T1==cGFydG5lcXN0PQ==', // Add a token for that session here
};
const options = {
timeout: timeoutSeconds * 1000, // 5000 (5 seconds) but less than 30000 (30 seconds)
};
const otNetworkTest = new NetworkTest(OT, sessionInfo, options);
} catch (error) {
console.error('[PreCallCheck] startNetWorkTest failed: ', error);
}
};