summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2021-06-28 18:34:10 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2021-06-28 18:34:10 +0900
commit0bab0554419835c8615d9f2d70b7009213f1f4a3 (patch)
treefbe77ae9a1c68c497533d34996d3af112946fd02
parentadd test (diff)
downloadmisskey-0bab0554419835c8615d9f2d70b7009213f1f4a3.tar.gz
misskey-0bab0554419835c8615d9f2d70b7009213f1f4a3.tar.bz2
misskey-0bab0554419835c8615d9f2d70b7009213f1f4a3.zip
refactor
Diffstat (limited to '')
-rw-r--r--src/streaming.ts17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/streaming.ts b/src/streaming.ts
index 70cf0a4f26..26137d1885 100644
--- a/src/streaming.ts
+++ b/src/streaming.ts
@@ -269,12 +269,9 @@ abstract class Connection<Channel extends Channels[keyof Channels] = any> extend
}
@autobind
- public send(id: string, typeOrPayload: any, payload?: any) {
- const type = payload === undefined ? typeOrPayload.type : typeOrPayload;
- const body = payload === undefined ? typeOrPayload.body : payload;
-
+ public send<T extends keyof Channel['receives']>(type: T, body: Channel['receives'][T]) {
this.stream.send('ch', {
- id: id,
+ id: this.id,
type: type,
body: body
});
@@ -300,11 +297,6 @@ class SharedConnection<Channel extends Channels[keyof Channels] = any> extends C
}
@autobind
- public send(typeOrPayload: any, payload?: any) {
- super.send(this.pool.id, typeOrPayload, payload);
- }
-
- @autobind
public dispose() {
this.pool.dec();
this.removeAllListeners();
@@ -335,11 +327,6 @@ class NonSharedConnection<Channel extends Channels[keyof Channels] = any> extend
}
@autobind
- public send(typeOrPayload: any, payload?: any) {
- super.send(this.id, typeOrPayload, payload);
- }
-
- @autobind
public dispose() {
this.removeAllListeners();
this.stream.send('disconnect', { id: this.id });