1
Directline Webchat을 사용하여 웹 응용 프로그램을 다시로드하는 방법은 무엇입니까?Directline Webchat을 사용하여 웹 응용 프로그램을 다시로드하는 방법은 무엇입니까?
또는 Directline Webchat이 Bot으로부터 응답을받은 후 Javascript 기능을 호출 할 수있는 방법이 있습니까?
Directline Webchat을 사용하여 웹 응용 프로그램을 다시로드하는 방법은 무엇입니까?Directline Webchat을 사용하여 웹 응용 프로그램을 다시로드하는 방법은 무엇입니까?
또는 Directline Webchat이 Bot으로부터 응답을받은 후 Javascript 기능을 호출 할 수있는 방법이 있습니까?
당신은이에 대한 웹 채팅 컨트롤의 백 채널을 사용할 수
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;
}
이 예는 로봇이 웹 채팅 및 변경 페이지의 backgroundColor를하는 changeBackground 이벤트를 보낼 수있는 방법을 보여줍니다.
은에서 : 대신 changeBackground 이벤트의 https://github.com/Microsoft/BotFramework-WebChat/blob/master/samples/backchannel/index.html
, 당신은 자바 스크립트 location.reload을()는 reloadPage 이벤트를 전송하고 호출 할 수 있습니다.