Mibew / mibew

Mibew Messenger - open-source live support application
https://mibew.org
Other
471 stars 204 forks source link

Visitor with multiple tabs open spams staff side of chat with new location messages #257

Closed tzeumer closed 3 years ago

tzeumer commented 3 years ago

(I hope it's not a duplicate, but the forum search didn't let me pass the "I'm no robot" check)

Environment

Expected behavior & Steps to reproduce the behavior

Settings: button uses full url with https. And (important maybe) the button forces a new browser window.

  1. Visitor has multiple tabs with the integrated mibew chat button open (different pages, but same ChatPopups['code'], because used in aside of a content management system)
  2. The visitor opens a chat in one tab
  3. Someone from the service staff answers
  4. The staff window should only display the current site the user is on

Actual behavior

For each tab the staff window receives a never ending stream of "Visitor changed to http..." like:

image

Question

Is there some way to disable this behavior or suppress this message?

Thanks in advance

tzeumer commented 3 years ago

I'm generating a random id on each page load (like $mibew_id = uniqid() . dechex(rand(0, pow(2, 12)));) to be used in the button code now. I think that should do the trick. Or would there be a better solution :)

Edit: This does not work. I thought the visitor were tracked by this ID, but seems to be somehow else.

Edit 2021-05-27: I disabled the feature in ButtonController.php and will look into doing it in a cleaner way later. For now this should work fine for us this way. So, if this is too special a case this ticket could just be closed.

And since it occasionally needs to be said: thank you for this very nice software :)

faf commented 3 years ago

Well, it's not a bug. For Mibew it's just impossible to tell apart a visitor navigating between pages and a visitor switching between tabs. Technically that behaviour almost identical.

However, if you'll be able to figure out the way to do so, probably it would be possible to make a plugin that alters messages using \Mibew\EventDispatcher\Events::THREAD_GET_MESSAGES_ALTER event. In theory. ;)