2017-12-22 4 views

Antwort

2

Sie könnten der WebChat Kontrolle des Rückkanal für diesen Einsatz:

 const user = { 
     id: 'userid', 
     name: 'username' 
     }; 
     const bot = { 
     id: 'botid', 
     name: 'botname' 
     }; 

    const botConnection = new BotChat.DirectLine({ 
     secret: 'SECRET' 
     }); 

     BotChat.App({ 
     bot: bot, 
     botConnection: botConnection, 
     user: user 
     }, document.getElementById('BotChatGoesHere')); 

     botConnection.activity$ 
     .filter(function (activity) { 
      return activity.type === 'event' && activity.name === 'changeBackground'; 
     }) 
     .subscribe(function (activity) { 
      console.log('"changeBackground" received with value: ' + activity.value); 
      changeBackgroundColor(activity.value); 
     }); 

     function changeBackgroundColor(newColor) { 
     document.body.style.backgroundColor = newColor; 
     } 

Dieses Beispiel zeigt, wie ein Bot ein changeBackground Ereignis die Backgroundcolor auf der Seite geändert Webchat und haben schicken.

Von: https://github.com/Microsoft/BotFramework-WebChat/blob/master/samples/backchannel/index.html

Statt eines changeBackground Ereignis können Sie eine reloadPage Ereignis und rufen location.reload() in javascript senden.