chore: Migrate PubSub Token to contact inbox (#3434)

At present, the websocket pubsub tokens are present at the contact objects in chatwoot. A better approach would be to have these tokens at the contact_inbox object instead. This helps chatwoot to deliver the websocket events targetted to the specific widget connection, stop contact events from leaking into other chat sessions from the same contact.

Fixes #1682
Fixes #1664

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
Sojan Jose 2021-11-22 23:32:17 +05:30 committed by GitHub
parent 01577acb2e
commit 791d90c6b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 211 additions and 95 deletions

View file

@ -15,18 +15,6 @@ class ActionCableConnector extends BaseActionCableConnector {
};
}
static refreshConnector = pubsubToken => {
if (!pubsubToken || window.chatwootPubsubToken === pubsubToken) {
return;
}
window.chatwootPubsubToken = pubsubToken;
window.actionCable.disconnect();
window.actionCable = new ActionCableConnector(
window.WOOT_WIDGET,
window.chatwootPubsubToken
);
};
onStatusChange = data => {
this.app.$store.dispatch('conversationAttributes/update', data);
};
@ -57,7 +45,7 @@ class ActionCableConnector extends BaseActionCableConnector {
onTypingOn = data => {
if (data.is_private) {
return
return;
}
this.clearTimer();
this.app.$store.dispatch('conversation/toggleAgentTyping', {
@ -88,7 +76,4 @@ class ActionCableConnector extends BaseActionCableConnector {
};
}
export const refreshActionCableConnector =
ActionCableConnector.refreshConnector;
export default ActionCableConnector;