ryanvolum / offline-directline

Unofficial package to emulate the bot framework connector locally.
https://www.npmjs.com/package/offline-directline
78 stars 44 forks source link

Unable to do multi user conversation with bot at a time. #3

Closed Kothakapu closed 7 years ago

Kothakapu commented 7 years ago

Hi Ryan,

Thanks for providing code and it's working fine when we do single user chat conversation with bot. Could you please suggest the place where do we need to add logic to handle multi user conversation at a time with bot.

Thanks in advance.

Thanks & Regards, Satheesh K.

ryanvolum commented 7 years ago

Hey @Kothakapu,

You'd add this on your client side. The connector is storing conversation data with keys that are built using conversationId, channelId and userId. In the webchat sample, the user's id defaults to 'userid' (see code below). If you want to customize data per user, you would set your own userId per instance of webchat. This user id might be based on a user logged into your page or it could just be a GUID you create for each session that opens the page. var user = { id: params['userid'] || 'userid', name: params["username"] || 'username' };

I was just able to accomplish this by changing the id line above to: id: Math.random().toString(36).substring(7),

ryanvolum commented 7 years ago

This should solve your problem! Let me know if you have any issues.

Best, Ryan

Klervix commented 6 years ago

Hi! I use random ids, but it still doesn't solve the problem. When a user replies to my chatbot, all the users receive an answer. It doesn't do it with DirectLine online. Any idea?

Thank you :)