Skip to content

Commit

Permalink
update subscription correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
rockwellll committed Jan 13, 2025
1 parent 326d99c commit 67bf283
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/hellotext.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions lib/channels/application_channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ var ApplicationChannel = /*#__PURE__*/function () {
if (this.ignoredEvents.includes(type)) {
return;
}
console.log(event);
callback(message);
});
}
Expand All @@ -59,7 +58,7 @@ var ApplicationChannel = /*#__PURE__*/function () {
}, {
key: "ignoredEvents",
get: function get() {
return ['ping', 'welcome'];
return ['ping', 'confirm_subscription', 'welcome'];
}
}]);
return ApplicationChannel;
Expand Down
2 changes: 1 addition & 1 deletion lib/controllers/webchat_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ var _default = /*#__PURE__*/function (_Controller) {
_hellotext.default.eventEmitter.dispatch('webchat:message:sent', message);
if (data.conversation !== this.conversationIdValue) {
this.conversationIdValue = data.conversation;
this.webChatChannel.subscribe(this.conversationIdValue);
this.webChatChannel.updateSubscriptionWith(this.conversationIdValue);
}
});
function sendMessage() {
Expand Down
4 changes: 1 addition & 3 deletions src/channels/application_channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ class ApplicationChannel {
return;
}

console.log(event)

callback(message)
})
}
Expand All @@ -40,7 +38,7 @@ class ApplicationChannel {
}

get ignoredEvents() {
return ['ping', 'welcome']
return ['ping', 'confirm_subscription', 'welcome']
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/controllers/webchat_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export default class extends Controller {

if(data.conversation !== this.conversationIdValue) {
this.conversationIdValue = data.conversation
this.webChatChannel.subscribe(this.conversationIdValue)
this.webChatChannel.updateSubscriptionWith(this.conversationIdValue)
}
}

Expand Down

0 comments on commit 67bf283

Please sign in to comment.