good morning brother I hope you are very well, first I want to congratulate you for a great job. I have several implementation questions and I hope you can help me. I need to make an api where I can connect several sessions, therefore I need to do it in an orderly way. I explain to you I have several routes as I told you before, I have routes to start the session, I have routes to see contacts, I have routes to see groups, example
builder() {
this.router.get ('/ retrieve-all-messages /: chatId', homeController.retrieveAllMessages);
this.router.get ('/ new-message /: contactId /: message', homeController.newMessage);
this.router.get ('/ get-connections-state', homeController.getConnectionState);
this.router.get ('/ validate-number /: number', homeController.validateNumber);
this.router.get ('/ check-status-device', homeController.checkStatusDevices);
this.router.get ('/ get-battery-level', homeController.getBatteryLevel);
this.router.get ('/ get-host-devices', homeController.getHostDevice);
this.router.get ('/ contacts', homeController.contacts);
this.router.get ('/ groups', homeController.groups);
this.router.get ('/ unread', homeController.unread);
this.router.get ('/ test', homeController.test);
}
Now, at the session start which is test, I would like to return to the front client a token or something that allows me to identify the session and attach it to each request so that I do not have to make each request to create the 'client' intact but only Check if the session is active or not, and process the request. Why? good because currently all the methods that I use from your library are instantiated from the client object that the correct create method returns to me? so what does that mean? that for me to be able to obtain the contacts I execute the create method and then I pass it to that action so this always generates a delay in the responses from my server. so I wish I could optimize that process. Do you have any idea how I can do something like that?
/ auth return token
/ get-message /: token
for example something like this, where you don't need to create every time
get-message () {
token = req.params.token
if (token === valid) {
res.send (token.getContacts)
}
}
as well
venom.create ('test'). then (async (client: any) => {
client.sendText (req.params.contactId, req.params.message);
res.status (200) .send (message sent: $ {req.params.message}
);
});
because the venom.create ('') part I'm always doing