feat: http与ws共站支持热重载

This commit is contained in:
挂神
2024-07-24 13:02:37 +08:00
parent f7bdc35ed6
commit 25bca8385d
4 changed files with 62 additions and 37 deletions

View File

@@ -70,10 +70,12 @@ export class WebsocketServerBase {
}
stop() {
this.ws && this.ws.close((err) => {
log('ws server close failed!', err);
});
this.ws = null;
if (this.ws) {
this.ws.close((err) => {
if (err) log('ws server close failed!', err);
});
this.ws = null;
}
}
restart(port: number) {