This commit is contained in:
tamaina 2021-09-12 01:27:20 +09:00
parent 8cafc4ee55
commit 380d357a74

View file

@ -47,8 +47,8 @@ export default class Connection {
this.wsConnection.on('message', this.onWsConnectionMessage); this.wsConnection.on('message', this.onWsConnectionMessage);
this.subscriber.on('broadcast', async ev => { this.subscriber.on('broadcast', data => {
this.onBroadcastMessage(ev.type, ev.body); this.onBroadcastMessage(data);
}); });
if (this.user) { if (this.user) {
@ -58,9 +58,7 @@ export default class Connection {
this.updateFollowingChannels(); this.updateFollowingChannels();
this.updateUserProfile(); this.updateUserProfile();
this.subscriber.on(`user:${this.user.id}`, ev => { this.subscriber.on(`user:${this.user.id}`, this.onUserEvent);
this.onUserEvent(ev);
});
} }
} }
@ -146,8 +144,8 @@ export default class Connection {
} }
@autobind @autobind
private onBroadcastMessage(type: string, body: any) { private onBroadcastMessage(data: StreamMessages['broadcast']['spec']) {
this.sendMessageToWs(type, body); this.sendMessageToWs(data.type, data.body);
} }
@autobind @autobind