Closed robbiew closed 5 years ago
@robbiew can you check this PR #1286?
We are still drafting this. Since it touch pretty much every saga (a.k.a. business logic) on the production code, it's pending a thorough test.
The reason we need a production code change is to make the sample simpler and more intuitive. You can look at the proposed sample here.
const store = window.WebChat.createStore({}, ({ dispatch }) => next => action => {
if (action.type === 'DIRECT_LINE/CONNECT_FULFILLED') {
dispatch({
type: 'WEB_CHAT/SEND_EVENT',
payload: {
name: 'webchat/join',
value: { language: window.navigator.language }
}
});
}
return next(action);
});
Expect it to drop as dev build around end of December. Production build around mid February (or earlier if we decided to release a point release.)
Hi @compulim,
I am testing the above code, and though the event seems to be fired, I see nothing on the bot.
Using dev <script src="https://cdn.botframework.com/botframework-webchat/master/webchat.js"></script>
...
And this client code ...
(async function () {
const store = window.WebChat.createStore({}, ({ dispatch }) => next => action => {
if (action.type === 'DIRECT_LINE/CONNECT_FULFILLED') {
console.log("Sending activity ...")
dispatch({
type: 'WEB_CHAT/SEND_EVENT',
payload: {
name: 'webchat/join',
value: { language: window.navigator.language }
}
});
}
return next(action);
});
window.WebChat.renderWebChat({
userID: params['userid'],
directLine: window.WebChat.createDirectLine({
token: params['directLineToken']
}),
store
}, document.getElementById('botChat'));
document.querySelector('#botChat > *').focus();
})().catch(err => console.error(err));
Browser console shows "Sending activity ...", but nothing arrives at the bot as far as I can tell, where my bot is defined ...
// Listen for incoming activities and route them to your bot main dialog.
server.post('/api/messages', (req, res) => {
// Route received a request to adapter for processing
adapter.processActivity(req, res, async (turnContext) => {
// route to bot activity handler.
await bot.onTurn(turnContext);
});
});
And ....
async onTurn(turnContext) {
console.log("STUFF2: " + JSON.stringify(turnContext))
}
Is there something I'm doing wrong please? thanks, Matt
We are seeing the same problem - any updates on a fix?
@compulim Looks like we missed the dec projection is there a revised estimate?
passing parameters with v3 was so easy..... need help with v4 :(
Looks like the latest PR on this subject, completed with a sample, will help you:
Enjoy!
Thanks @nrobert.
Yea, running back-and-forth multiple times on the code and finally it is in! Now in development branch, @4.2.1-master.849e563
.
The reason it took so long is because we revamped most sagas. We didn't notice that take(A)
-> put
-> take(A)
-> put -> (loop), is not an atomic operation. In this pattern, we will miss some A
actions. Instead, we need to do takeEvery(A, put)
-> (loop) instead.
It is in, tell me what you think about it. 😄
Having trouble finding any code examples in the repo for Backchannel usage, specifically around using postactivity -- triggering events (I'm using ReactWebChat).
The goal is to trigger a pro-active message via Backchannel to the user as a welcome (using Directline).
This may be sames as #1441
Do any such examples exist? Thanks!