From 2b536a744391fe3c44accac7993ef9910c911248 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 13 Oct 2018 19:14:05 +0900 Subject: [PATCH] =?UTF-8?q?connected=E3=82=A4=E3=83=99=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=81=AFpong=E3=83=91=E3=83=A9=E3=83=A1=E3=83=BC=E3=82=BF?= =?UTF-8?q?=E3=81=8Ctrue=E3=81=AE=E6=99=82=E3=81=A0=E3=81=91=E7=99=BA?= =?UTF-8?q?=E8=A1=8C=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/api/stream/index.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/server/api/stream/index.ts b/src/server/api/stream/index.ts index 6d3675c94b..e376b7a29e 100644 --- a/src/server/api/stream/index.ts +++ b/src/server/api/stream/index.ts @@ -146,9 +146,9 @@ export default class Connection { */ @autobind private onChannelConnectRequested(payload: any) { - const { channel, id, params } = payload; + const { channel, id, params, pong } = payload; log(`CH CONNECT: ${id} ${channel} by @${this.user.username}`); - this.connectChannel(id, params, channel); + this.connectChannel(id, params, channel, pong); } /** @@ -177,7 +177,7 @@ export default class Connection { * チャンネルに接続 */ @autobind - public connectChannel(id: string, params: any, channel: string) { + public connectChannel(id: string, params: any, channel: string, pong = false) { // 共有可能チャンネルに接続しようとしていて、かつそのチャンネルに既に接続していたら無意味なので無視 if ((channels as any)[channel].shouldShare && this.channels.some(c => c.chName === channel)) { return; @@ -186,9 +186,12 @@ export default class Connection { const ch: Channel = new (channels as any)[channel](id, this); this.channels.push(ch); ch.init(params); - this.sendMessageToWs('connected', { - id: id - }); + + if (pong) { + this.sendMessageToWs('connected', { + id: id + }); + } } /**