add queueing of commands

This commit is contained in:
Dave Horton
2022-02-24 09:37:09 -05:00
parent 5cbdddffc9
commit 47a9df3312
4 changed files with 8 additions and 7 deletions

View File

@@ -19,7 +19,7 @@ module.exports = (ws, {logger, req}) => {
}
};
ws.sendCommand = (command, payload) => {
ws.sendCommand = (command, payload, queueCommand = false) => {
payload = payload instanceof WebhookResponse ? payload.toJSON() : payload;
assert.ok(typeof payload === 'object' && Object.keys(payload).length > 0,
'invalid or missing payload');
@@ -28,6 +28,7 @@ module.exports = (ws, {logger, req}) => {
const msg = {
type: 'command',
command,
queueCommand,
data: payload
};
try {

View File

@@ -30,9 +30,9 @@ class WsSession extends Emitter {
_setHandlers() {
this.ws
.on('close', this._onClose.bind(this))
.on('message', this._onMessage.bind(this))
.on('error', this._onError.bind(this));
//.on('close', this._onClose.bind(this))
//.on('error', this._onError.bind(this))
.on('message', this._onMessage.bind(this));
}
_onMessage(data, isBinary) {

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@jambonz/node-client",
"version": "0.3.3",
"version": "0.3.5",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@jambonz/node-client",
"version": "0.3.3",
"version": "0.3.5",
"license": "MIT",
"dependencies": {
"bent": "^7.3.12",

View File

@@ -1,6 +1,6 @@
{
"name": "@jambonz/node-client",
"version": "0.3.4",
"version": "0.3.5",
"description": "Node.js client for building jambonz applications (jambonz.org)",
"main": "lib/index.js",
"scripts": {