WebSockets: add support for a message callback in ardour.js

This commit is contained in:
Luciano Iam 2020-04-12 14:56:09 +02:00 committed by Robin Gareus
parent c5366427d0
commit b8f52a519a
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -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);
}
}