Rocket.Chat.js.SDK icon indicating copy to clipboard operation
Rocket.Chat.js.SDK copied to clipboard

[BUG] Reopen the connection causes duplication of messages

Open cuonghuunguyen opened this issue 4 years ago • 0 comments

Description

When the DDP connection to the BOT gets lost, the BOT will try to reopen the connection. When the connection is back, it will try to re-subscribe to the topics without unsubscribing the old ones. That can cause duplication of the message in the method bot.respondToMessages()

Step to reproduce

  • Run a bot which replies the incoming messages with respondToMessages() method
  • Disconnect the connection between the bot and the RocketChat server (turn off the server/turn off Nginx/etc)
  • Wait for the bot to start to reopen connection interval
  • Reconnect the connection between the bot and the RocketChat server

Expected behavior

Bot calls the callback in responseToMessages() once per message

Actual behavior

Bot calls the callback in responseToMessages() multiple times per message

cuonghuunguyen avatar Jun 12 '20 06:06 cuonghuunguyen