mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
refactor(): remove redundancy, extract handleEvent
This commit is contained in:
@@ -7,7 +7,6 @@ import {
|
||||
CLOSE_EVENT,
|
||||
ERROR_EVENT,
|
||||
MESSAGE_EVENT,
|
||||
NO_EVENT_HANDLER,
|
||||
NO_MESSAGE_HANDLER,
|
||||
TCP_DEFAULT_PORT,
|
||||
} from '../constants';
|
||||
@@ -77,14 +76,6 @@ export class ServerTCP extends Server implements CustomTransportStrategy {
|
||||
);
|
||||
}
|
||||
|
||||
public async handleEvent(pattern: string, packet: ReadPacket): Promise<any> {
|
||||
const handler = this.getHandlerByPattern(pattern);
|
||||
if (!handler) {
|
||||
return this.logger.error(NO_EVENT_HANDLER);
|
||||
}
|
||||
await handler(packet.data);
|
||||
}
|
||||
|
||||
public handleClose(): undefined | number | NodeJS.Timer {
|
||||
if (
|
||||
this.isExplicitlyTerminated ||
|
||||
|
||||
Reference in New Issue
Block a user