diff --git a/syncplay/plugin.json b/syncplay/plugin.json index b3a9c13..a5451e1 100644 --- a/syncplay/plugin.json +++ b/syncplay/plugin.json @@ -2,7 +2,7 @@ "main": "plugin.js", "name": "syncplay", "description": "Syncplay Service for Squeebot 3", - "version": "1.0.2", + "version": "1.0.3", "tags": ["service", "syncplay"], "dependencies": ["control?"], "npmDependencies": [] diff --git a/syncplay/plugin.ts b/syncplay/plugin.ts index a6835d4..cb42d56 100644 --- a/syncplay/plugin.ts +++ b/syncplay/plugin.ts @@ -196,16 +196,22 @@ class SyncplayProtocol extends Protocol { password = crypto.createHash('md5').update(password).digest('hex'); } - this.socket = net.connect(opts, () => { - this.write({ - Hello: { - username: this.config.syncplay.name, - password, - room: { name: this.config.syncplay.room }, - version: PROTOCOL_VERSION - } + try { + this.socket = net.connect(opts, () => { + this.write({ + Hello: { + username: this.config.syncplay.name, + password, + room: { name: this.config.syncplay.room }, + version: PROTOCOL_VERSION + } + }); }); - }); + } catch(err: any) { + this.emit('error', err); + this.stop(true); + return; + } let buffer: any = ''; this.socket.on('data', (chunk) => {