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) {