How to use botframework-directlinejs - 10 common examples

To help you get started, we’ve selected a few botframework-directlinejs 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 aiden / autobot / src / clients / botframework_client.ts View on Github external
.subscribe((connectionStatus) => {
        this.conectionStatus = connectionStatus;
        switch (connectionStatus) {
          case ConnectionStatus.Uninitialized:
            // the status when the DirectLine object is first created/constructed
            break;
          case ConnectionStatus.Connecting:
            // currently trying to connect to the conversation
            if (program.verbose) {
              console.log('Connecting to DirectLine...');
            }
            break;
          case ConnectionStatus.Online:
            // successfully connected to the converstaion. Connection is healthy so far as we know.
            if (program.verbose) {
              console.log('Connected to DirectLine.');
            }
            if (this.onReadyCb) {
              this.onReadyCb();
            }
            break;
          case ConnectionStatus.ExpiredToken:
            // last operation errored out with an expired token. Your app should supply a new one.
            console.log('DirectLine error: token expired.');
            process.exit(1);
            break;
          case ConnectionStatus.FailedToConnect:
            // the initial attempt to connect to the conversation failed. No recovery possible.
            console.log('DirectLine error: failed to connect.');
github aiden / autobot / src / clients / botframework_client.ts View on Github external
}
            if (this.onReadyCb) {
              this.onReadyCb();
            }
            break;
          case ConnectionStatus.ExpiredToken:
            // last operation errored out with an expired token. Your app should supply a new one.
            console.log('DirectLine error: token expired.');
            process.exit(1);
            break;
          case ConnectionStatus.FailedToConnect:
            // the initial attempt to connect to the conversation failed. No recovery possible.
            console.log('DirectLine error: failed to connect.');
            process.exit(1);
            break;
          case ConnectionStatus.Ended:
            // the bot ended the conversation
            break;
        }
      });
  }
github aiden / autobot / src / clients / botframework_client.ts View on Github external
case ConnectionStatus.Connecting:
            // currently trying to connect to the conversation
            if (program.verbose) {
              console.log('Connecting to DirectLine...');
            }
            break;
          case ConnectionStatus.Online:
            // successfully connected to the converstaion. Connection is healthy so far as we know.
            if (program.verbose) {
              console.log('Connected to DirectLine.');
            }
            if (this.onReadyCb) {
              this.onReadyCb();
            }
            break;
          case ConnectionStatus.ExpiredToken:
            // last operation errored out with an expired token. Your app should supply a new one.
            console.log('DirectLine error: token expired.');
            process.exit(1);
            break;
          case ConnectionStatus.FailedToConnect:
            // the initial attempt to connect to the conversation failed. No recovery possible.
            console.log('DirectLine error: failed to connect.');
            process.exit(1);
            break;
          case ConnectionStatus.Ended:
            // the bot ended the conversation
            break;
        }
      });
  }
github aiden / autobot / src / clients / botframework_client.ts View on Github external
break;
          case ConnectionStatus.Online:
            // successfully connected to the converstaion. Connection is healthy so far as we know.
            if (program.verbose) {
              console.log('Connected to DirectLine.');
            }
            if (this.onReadyCb) {
              this.onReadyCb();
            }
            break;
          case ConnectionStatus.ExpiredToken:
            // last operation errored out with an expired token. Your app should supply a new one.
            console.log('DirectLine error: token expired.');
            process.exit(1);
            break;
          case ConnectionStatus.FailedToConnect:
            // the initial attempt to connect to the conversation failed. No recovery possible.
            console.log('DirectLine error: failed to connect.');
            process.exit(1);
            break;
          case ConnectionStatus.Ended:
            // the bot ended the conversation
            break;
        }
      });
  }
github aiden / autobot / src / clients / botframework_client.ts View on Github external
.subscribe((connectionStatus) => {
        this.conectionStatus = connectionStatus;
        switch (connectionStatus) {
          case ConnectionStatus.Uninitialized:
            // the status when the DirectLine object is first created/constructed
            break;
          case ConnectionStatus.Connecting:
            // currently trying to connect to the conversation
            if (program.verbose) {
              console.log('Connecting to DirectLine...');
            }
            break;
          case ConnectionStatus.Online:
            // successfully connected to the converstaion. Connection is healthy so far as we know.
            if (program.verbose) {
              console.log('Connected to DirectLine.');
            }
            if (this.onReadyCb) {
              this.onReadyCb();
            }
github aiden / autobot / src / clients / botframework_client.ts View on Github external
.subscribe((connectionStatus) => {
        this.conectionStatus = connectionStatus;
        switch (connectionStatus) {
          case ConnectionStatus.Uninitialized:
            // the status when the DirectLine object is first created/constructed
            break;
          case ConnectionStatus.Connecting:
            // currently trying to connect to the conversation
            if (program.verbose) {
              console.log('Connecting to DirectLine...');
            }
            break;
          case ConnectionStatus.Online:
            // successfully connected to the converstaion. Connection is healthy so far as we know.
            if (program.verbose) {
              console.log('Connected to DirectLine.');
            }
            if (this.onReadyCb) {
              this.onReadyCb();
            }
            break;
          case ConnectionStatus.ExpiredToken:
            // last operation errored out with an expired token. Your app should supply a new one.
github microsoft / BotFramework-WebChat / src / Chat.tsx View on Github external
componentDidMount() {
        // Now that we're mounted, we know our dimensions. Put them in the store (this will force a re-render)
        this.setSize();

        const botConnection = this.props.directLine
            ? (this.botConnection = new DirectLine(this.props.directLine))
            : this.props.botConnection
            ;

        if (this.props.resize === 'window') {
            window.addEventListener('resize', this.resizeListener);
        }

        this.store.dispatch({ type: 'Start_Connection', user: this.props.user, bot: this.props.bot, botConnection, selectedActivity: this.props.selectedActivity });

        this.connectionStatusSubscription = botConnection.connectionStatus$.subscribe(connectionStatus => {
                if (this.props.speechOptions && this.props.speechOptions.speechRecognizer) {
                    const refGrammarId = botConnection.referenceGrammarId;
                    if (refGrammarId) {
                        this.props.speechOptions.speechRecognizer.referenceGrammarId = refGrammarId;
                    }
                }
github UdacityMobileWebScholarship / udabot / Frontend / BotFramework-WebChat / src / Chat.tsx View on Github external
componentDidMount() {
        // Now that we're mounted, we know our dimensions. Put them in the store (this will force a re-render)
        this.setSize();

        const botConnection = this.props.directLine
            ? (this.botConnection = new DirectLine(this.props.directLine))
            : this.props.botConnection
            ;

        if (this.props.resize === 'window')
            window.addEventListener('resize', this.resizeListener);

        this.store.dispatch({ type: 'Start_Connection', user: this.props.user, bot: this.props.bot, botConnection, selectedActivity: this.props.selectedActivity });

        this.connectionStatusSubscription = botConnection.connectionStatus$.subscribe(connectionStatus =>{
                if(this.props.speechOptions && this.props.speechOptions.speechRecognizer){
                    let refGrammarId = botConnection.referenceGrammarId;
                    if(refGrammarId)
                        this.props.speechOptions.speechRecognizer.referenceGrammarId = refGrammarId;
                }
                this.store.dispatch({ type: 'Connection_Change', connectionStatus })
            }
github Capgemini-AIE / bot-framework-actions-on-google / lib / directline / DirectLineManager.js View on Github external
createConversation() {
    console.log(this._token);
    return new DirectLineWrapper(new DirectLine({
      token: this._token,
      webSocket: true
    }));
  }
  getToken(directlineSecret) {
github aiden / autobot / src / clients / botframework_client.ts View on Github external
constructor(directLineSecret: string, domain?: string) {
    super();
    this.directLine = new DirectLine({ domain, secret: directLineSecret, webSocket: !domain });
    this.subscribeToConnectionStatus();
  }