Compare commits
4 Commits
d4df7d45c3
...
e69e7a67b6
Author | SHA1 | Date |
---|---|---|
Derrick Hammer | e69e7a67b6 | |
Derrick Hammer | 1f76aef53a | |
Derrick Hammer | e84b009244 | |
Derrick Hammer | e211fa3b48 |
|
@ -54,7 +54,7 @@ export class Socket extends Client {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
on(event, fn, context) {
|
on(event, fn, context) {
|
||||||
const [update, promise] = this.connectModule("listenSocketEvent", { id: this.id, event: event }, (data) => {
|
const [update, promise] = this.connectModule("socketListenEvent", { id: this.id, event: event }, (data) => {
|
||||||
this.emit(event, data);
|
this.emit(event, data);
|
||||||
});
|
});
|
||||||
this.trackEvent(event, update);
|
this.trackEvent(event, update);
|
||||||
|
@ -72,12 +72,12 @@ export class Socket extends Client {
|
||||||
return super.off(event, fn, context, once);
|
return super.off(event, fn, context, once);
|
||||||
}
|
}
|
||||||
write(message) {
|
write(message) {
|
||||||
this.callModule("write", { id: this.id, message });
|
this.callModule("socketWrite", { id: this.id, message });
|
||||||
}
|
}
|
||||||
end() {
|
end() {
|
||||||
this.callModule("socketExists", { id: this.id }).then(([exists]) => {
|
this.callModule("socketExists", { id: this.id }).then(([exists]) => {
|
||||||
if (exists) {
|
if (exists) {
|
||||||
this.callModule("close", { id: this.id });
|
this.callModule("socketClose", { id: this.id });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ export class Socket extends Client {
|
||||||
context?: any
|
context?: any
|
||||||
): this {
|
): this {
|
||||||
const [update, promise] = this.connectModule(
|
const [update, promise] = this.connectModule(
|
||||||
"listenSocketEvent",
|
"socketListenEvent",
|
||||||
{ id: this.id, event: event },
|
{ id: this.id, event: event },
|
||||||
(data: any) => {
|
(data: any) => {
|
||||||
this.emit(event, data);
|
this.emit(event, data);
|
||||||
|
@ -109,14 +109,14 @@ export class Socket extends Client {
|
||||||
}
|
}
|
||||||
|
|
||||||
write(message: string | Buffer): void {
|
write(message: string | Buffer): void {
|
||||||
this.callModule("write", { id: this.id, message });
|
this.callModule("socketWrite", { id: this.id, message });
|
||||||
}
|
}
|
||||||
|
|
||||||
end(): void {
|
end(): void {
|
||||||
this.callModule("socketExists", { id: this.id }).then(
|
this.callModule("socketExists", { id: this.id }).then(
|
||||||
([exists]: ErrTuple) => {
|
([exists]: ErrTuple) => {
|
||||||
if (exists) {
|
if (exists) {
|
||||||
this.callModule("close", { id: this.id });
|
this.callModule("socketClose", { id: this.id });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue