How to use the react-native-voximplant.Voximplant.ClientEvents function in react-native-voximplant

To help you get started, we’ve selected a few react-native-voximplant 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 voximplant / react-native-demo / src / manager / LoginManager.js View on Github external
constructor() {
        this.client = Voximplant.getInstance();
        // Connection to the Voximplant Cloud is stayed alive on reloading of the app's
        // JavaScript code. Calling "disconnect" API here makes the SDK and app states
        // synchronized.
        PushManager.init();
        (async() => {
            try {
                this.client.disconnect();
            } catch (e) {

            }
        })();
        this.client.on(Voximplant.ClientEvents.ConnectionClosed, this._connectionClosed);
    }
github voximplant / react-native-demo / src / manager / LoginManager.js View on Github external
async loginWithToken() {
        try {
            let state = await this.client.getClientState();
            if (state === Voximplant.ClientState.DISCONNECTED) {
                await this.client.connect();
            }
            if (state !== Voximplant.ClientState.LOGGED_IN) {
                const username = await AsyncStorage.getItem('usernameValue');
                const accessToken = await AsyncStorage.getItem('accessToken');
                console.log('LoginManager: loginWithToken: user: ' + username + ', token: ' + accessToken );
                const authResult = await this.client.loginWithToken(username + '.voximplant.com', accessToken);
                await this._processLoginSuccess(authResult);
            }
        } catch (e) {
            console.log('LoginManager: loginWithToken: ' + e.name);
            if (e.name === Voximplant.ClientEvents.AuthResult) {
                console.log('LoginManager: loginWithToken: error code: ' + e.code);
            }
        }
    }
github voximplant / react-native-demo / src / manager / CallManager.js View on Github external
init() {
        this.client.on(Voximplant.ClientEvents.IncomingCall, this._incomingCall);
        AppState.addEventListener('change', this._handleAppStateChange);
    }