summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuciano Iam <lucianito@gmail.com>2020-04-12 14:56:09 +0200
committerRobin Gareus <robin@gareus.org>2020-04-13 16:29:40 +0200
commitb8f52a519a06fe4bdaa8a0978d8116ebe310925b (patch)
tree83adda4cfedf48106123562f43dc2846a93c5620
parentc5366427d078434348322cd3ed3521e0fe508fc0 (diff)
WebSockets: add support for a message callback in ardour.js
-rw-r--r--share/web_surfaces/shared/ardour.js8
1 files changed, 7 insertions, 1 deletions
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);
}
}