Skip to content

Commit

Permalink
Merge pull request #30 from lucashuet93/ryvolum/timeout
Browse files Browse the repository at this point in the history
added two second timeout to basic node sample
  • Loading branch information
ryanvolum committed Apr 9, 2019
2 parents 4f1d437 + f8239f1 commit fc6e598
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions node/basic-sample/bot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,14 @@ server.post('/api/proactive', async (req, res) => {
let reference = req.body.reference;
let message = req.body.message;
await adapter.continueConversation(reference, async (turnContext) => {
// Wait two seconds
await timeout(2000);
await turnContext.sendActivity(message);
});
res.send(200);
});

// Promisified timeout helper
const timeout = (ms) => {
return new Promise(resolve => setTimeout(resolve, ms));
}

0 comments on commit fc6e598

Please sign in to comment.