From the course: Building Bots with Node.js
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Creating a session management service - Node.js Tutorial
From the course: Building Bots with Node.js
Creating a session management service
- [Instructor] To support sessions, we will first create the service that will provide us with a simple session management infrastructure. For that, I will create a new file, SessionService raw in services session. In there, I start off with class SessionService, and let's right away do this, module.exports for this SessionServices. Okay, then next we will add the constructor, and in this constructor, we basically do just some initialization because we need some object that will later hold all our sessions, so I add this.sessions equals curly brackets to initialize this empty object, and I also want to define the global timeout for my sessions, so I add this.timeout, and it should be five minutes. Next, let's add a little helper that will just give us the current timestamp, so add static now, and there I just return Math.floor, a new Date, divided by 1000, which is the UNIX timestamp in seconds. Next, we're going to…
Contents
-
-
-
-
-
(Locked)
Creating conversational flows2m 49s
-
(Locked)
Creating a session management service6m 32s
-
(Locked)
Preparing to add threaded sesssions2m 4s
-
(Locked)
Creating sessions and threads on mentions4m 15s
-
(Locked)
Handling threaded messages3m 44s
-
(Locked)
Implementing a conversation service6m 40s
-
(Locked)
Adding conversation awareness to slack5m 1s
-
(Locked)
Training special and partial utterances7m 3s
-
(Locked)
Handling greetings and good byes4m 13s
-
(Locked)
-
-