Nodejs and microsoft bot framework

404
May 18, 2017, at 4:09 PM

I am looking at the nodejs code here https://github.com/Microsoft/BotBuilder/blob/master/Node/examples/basics-waterfall/app.js

I am trying to understand this piece of code

var bot = new builder.UniversalBot(connector, [
    function (session) {
        ...
    },
    function (session, results) {
        ...
    },
    function (session, results) {
       ...
    },
    function (session, results) {
        ...
    }
]);

I understand that var bot is a function expression and takes in two parameters one is a connector and another is an array of functions.

Do these array of functions execute serially in the order they are defined ?

Comming from another programming background i am not familiar with this dialect.

How can i make this program more C# like is async await the answer ?

If async await is the answer how do i convert this to use the async/await paradigm ?

Answer 1

Yes, it seems like they are executing in the order they are defined.

You are supposed to provide only the function body in that array, the actual execution happens somewhere in the bot implementation, so you'd have to look there to get a clearer picture.

But judging from that example and common sense, it's clear that they are executed sequentially. It's a bot that answers questions in the order they are defined.

I'm not sure what you understand by "async" in this context, but if you want it to answer arbitrary requests, you can look at the other examples like basics-logging.

READ ALSO
Drawing graphics on canvas in node-js/Express

Drawing graphics on canvas in node-js/Express

I want to draw a chart on canvas elementMy Jade file contains following:

255
AWS Serverless Framework Nodejs Push Notification

AWS Serverless Framework Nodejs Push Notification

I am using Serverless framework to create lambda functions with nodejs backend that uses fcm-push package

363
How does performing processing server-side affect the overall performance of a site?

How does performing processing server-side affect the overall performance of a site?

I'm working on an application that will process data submitted by the user, and compare with past logged dataI don't need to return or respond to the post straight away, just need to process it

265
Difference between NodeJS and Python Hashing

Difference between NodeJS and Python Hashing

I'm attempting to port some NodeJS code to Python 3, but am having trouble getting a SHA1 hash to behave identically

265