We integrate Botpress into our website and want to use Locust.io to perform performance test. But I see that the response time of Create Message API is not enough. I want to measure the time: from Create Message API is sent, to the Bot Message is shown on message list. How can I do that without calling List Message API again and again (which can put more load on the bot)?
I see this code to real time listen the botResponse in Botpress documents (https://www.npmjs.com/package/@botpress/chat):
const listener = await client.listenConversation({
id: conversationId,
})
const botResponse = await new Promise<chat.Message>((resolve) => {
const onMessage = (ev: chat.Events['message_created']) => {
if (ev.userId === client.user.id) {
// message created by my current user, ignoring...
return
}
listener.off('message_created', onMessage)
resolve(ev)
}
listener.on('message_created', onMessage)
})
console.log("Bot's response:", botResponse.payload)
But I don’t know how to do the same in Python?