From b8f52a519a06fe4bdaa8a0978d8116ebe310925b Mon Sep 17 00:00:00 2001 From: Luciano Iam Date: Sun, 12 Apr 2020 14:56:09 +0200 Subject: WebSockets: add support for a message callback in ardour.js --- share/web_surfaces/shared/ardour.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/share/web_surfaces/shared/ardour.js b/share/web_surfaces/shared/ardour.js index ee58d9e298..d2d766cf99 100644 --- a/share/web_surfaces/shared/ardour.js +++ b/share/web_surfaces/shared/ardour.js @@ -34,6 +34,10 @@ export class Ardour { this.channel.close(); } + messageCallback (msg) { + // empty + } + // Surface metadata API over HTTP async getAvailableSurfaces () { @@ -62,7 +66,7 @@ export class Ardour { } // Surface control API over WebSockets channel - // client needs to call open() first + // clients need to call open() before calling these methods async getTempo () { return (await this._sendAndReceive(Node.TEMPO))[0]; @@ -131,6 +135,8 @@ export class Ardour { if (this.pendingRequest && (this.pendingRequest.hash == msg.hash)) { this.pendingRequest.resolve(msg.val); this.pendingRequest = null; + } else { + this.messageCallback(msg); } } -- cgit v1.2.3