From 5d91876974b45d35d7055f0c5841c825d62ddb0b Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Thu, 29 May 2025 19:43:54 -0300 Subject: [PATCH] feat: Restart WebSocket connection on Wavoip token update - Added logic to restart the WebSocket connection in `ChannelStartupService` when a valid `wavoipToken` is set, ensuring the client reconnects with updated settings. --- src/api/services/channel.service.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/api/services/channel.service.ts b/src/api/services/channel.service.ts index ef3ad24d..cf678f5c 100644 --- a/src/api/services/channel.service.ts +++ b/src/api/services/channel.service.ts @@ -200,6 +200,12 @@ export class ChannelStartupService { this.logger.verbose(`Settings wavoipToken: ${data.wavoipToken}`); Object.assign(this.localSettings, data); this.logger.verbose('Settings set'); + + // restart instance + if (this.localSettings.wavoipToken && this.localSettings.wavoipToken.length > 0) { + this.client.ws.close(); + this.client.ws.connect(); + } } public async findSettings() {