How to use the twilio-sync.SyncClient function in twilio-sync

To help you get started, we’ve selected a few twilio-sync 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 twilio-labs / plugin-flex-outbound-dialpad / src / OutboundDialingWithConferencePlugin.js View on Github external
//independent features
import { loadDialPadInterface } from "./components/dialpad"
import { loadExternalTransferInterface } from "./components/external-transfer"

// common libraries
import { registerReservationCreatedExtensions } from "./eventListeners/workerClient/reservationCreated";
import { registerActionExtensions } from "./eventListeners/actionsFramework"

import "./notifications/CustomNotifications";

const PLUGIN_NAME = "OutboundDialingWithConferencePlugin";

export const FUNCTIONS_HOSTNAME = '';
export const DEFAULT_FROM_NUMBER = ""; // twilio account or verified number
export const SYNC_CLIENT = new SyncClient(Manager.getInstance().user.token);

function tokenUpdateHandler() {

  console.log("OUTBOUND DIALPAD: Refreshing SYNC_CLIENT Token");

  const loginHandler = Manager.getInstance().store.getState().flex.session.loginHandler;

  const tokenInfo = loginHandler.getTokenInfo();
  const accessToken = tokenInfo.token;

  SYNC_CLIENT.updateToken(accessToken);
}


export default class OutboundDialingWithConferencePlugin extends FlexPlugin {
github twilio-labs / plugin-flex-realtime-stats-dashboard / src / components / RealTimeStats / MainView / MainView.js View on Github external
initSyncMapClient(queueStatsSyncMapName) {
    // create syncClient on component mount
    this.syncClient = new SyncClient(Manager.getInstance().user.token);

    // fetch initial data map
    this.syncClient
      .map(queueStatsSyncMapName)
      .then(map => {
        map
          .getItems()
          .then(paginator => {
            this.syncMapPageHandler(paginator);
          })
          .catch(function(error) {
            console.error("Map getItems() failed", error);
          });
      })
      .catch(function(error) {
        Notifications.showNotification("SyncMapNotAvailable", {
github dkundel / twilio-barista / client / lib / sync-client.js View on Github external
createClient(token) {
    const client = new SyncClient(token);
    client.on('connectionStateChanged', ({ connectionState }) => {
      if (
        connectionState === 'disconnected' ||
        connectionState === 'error' ||
        connectionState === 'denied'
      ) {
        console.error('lost connection...');
        this.emit('disconnected');
        this.client = undefined;
      }
    });
    return client;
  }
github dkundel / twilio-barista / client / debug.js View on Github external
.then(({ token }) => {
    console.log(token);
    client = new SyncClient(token);
    return client;
  })
  .then(client => {

twilio-sync

Twilio Sync client library

MIT
Latest version published 3 months ago

Package Health Score

59 / 100
Full package analysis

Popular twilio-sync functions

Similar packages