Skip to content

Commit 9393813

Browse files
committed
update channel
1 parent 528abd4 commit 9393813

File tree

7 files changed

+11
-7
lines changed

7 files changed

+11
-7
lines changed

dist/hellotext.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/channels/application_channel.js

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ var ApplicationChannel = /*#__PURE__*/function () {
4141
type,
4242
message
4343
} = data;
44+
console.log(event);
4445
if (this.ignoredEvents.includes(type)) {
4546
return;
4647
}

lib/channels/webchat_channel.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ var WebchatChannel = /*#__PURE__*/function (_ApplicationChannel) {
3434
}
3535
_createClass(WebchatChannel, [{
3636
key: "subscribe",
37-
value: function subscribe() {
37+
value: function subscribe(conversation) {
3838
var params = {
3939
channel: "WebchatChannel",
4040
id: this.id,
41-
session: this.session
41+
session: this.session,
42+
conversation
4243
};
4344
this.send({
4445
command: 'subscribe',

lib/controllers/webchat_controller.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ var _default = /*#__PURE__*/function (_Controller) {
293293
message.id = data.id;
294294
_hellotext.default.eventEmitter.dispatch('webchat:message:sent', message);
295295
this.conversationIdValue = data.conversation;
296-
this.webChatChannel.updateSubscription();
296+
this.webChatChannel.subscribe(this.conversationIdValue);
297297
});
298298
function sendMessage() {
299299
return _sendMessage.apply(this, arguments);

src/channels/application_channel.js

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class ApplicationChannel {
2121
const data = JSON.parse(event.data)
2222
const { type, message } = data
2323

24+
console.log(event)
2425
if (this.ignoredEvents.includes(type)) {
2526
return;
2627
}

src/channels/webchat_channel.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ class WebchatChannel extends ApplicationChannel {
1010
this.subscribe()
1111
}
1212

13-
subscribe() {
13+
subscribe(conversation) {
1414
const params = {
1515
channel: "WebchatChannel",
1616
id: this.id,
17-
session: this.session
17+
session: this.session,
18+
conversation,
1819
}
1920

2021
this.send( { command: 'subscribe', identifier: params })

src/controllers/webchat_controller.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ export default class extends Controller {
327327
Hellotext.eventEmitter.dispatch('webchat:message:sent', message)
328328

329329
this.conversationIdValue = data.conversation
330-
this.webChatChannel.updateSubscription()
330+
this.webChatChannel.subscribe(this.conversationIdValue)
331331
}
332332

333333
openAttachment() {

0 commit comments

Comments
 (0)