mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-23 09:23:48 +01:00
connectedイベントはpongパラメータがtrueの時だけ発行するように
This commit is contained in:
parent
c441671ca2
commit
82a12c1dd8
@ -146,9 +146,9 @@ export default class Connection {
|
|||||||
*/
|
*/
|
||||||
@autobind
|
@autobind
|
||||||
private onChannelConnectRequested(payload: any) {
|
private onChannelConnectRequested(payload: any) {
|
||||||
const { channel, id, params } = payload;
|
const { channel, id, params, pong } = payload;
|
||||||
log(`CH CONNECT: ${id} ${channel} by @${this.user.username}`);
|
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
|
@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)) {
|
if ((channels as any)[channel].shouldShare && this.channels.some(c => c.chName === channel)) {
|
||||||
return;
|
return;
|
||||||
@ -186,10 +186,13 @@ export default class Connection {
|
|||||||
const ch: Channel = new (channels as any)[channel](id, this);
|
const ch: Channel = new (channels as any)[channel](id, this);
|
||||||
this.channels.push(ch);
|
this.channels.push(ch);
|
||||||
ch.init(params);
|
ch.init(params);
|
||||||
|
|
||||||
|
if (pong) {
|
||||||
this.sendMessageToWs('connected', {
|
this.sendMessageToWs('connected', {
|
||||||
id: id
|
id: id
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* チャンネルから切断
|
* チャンネルから切断
|
||||||
|
Loading…
Reference in New Issue
Block a user