Skip to content
Snippets Groups Projects
Commit 0bab0554 authored by syuilo's avatar syuilo
Browse files

refactor

parent adb168df
No related branches found
No related tags found
No related merge requests found
......@@ -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
});
......@@ -299,11 +296,6 @@ class SharedConnection<Channel extends Channels[keyof Channels] = any> extends C
this.pool.inc();
}
@autobind
public send(typeOrPayload: any, payload?: any) {
super.send(this.pool.id, typeOrPayload, payload);
}
@autobind
public dispose() {
this.pool.dec();
......@@ -334,11 +326,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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment