mirror of
https://github.com/jambonz/jambonz-node.git
synced 2026-01-25 02:08:15 +00:00
add queueing of commands
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
4
package-lock.json
generated
@@ -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",
|
||||
|
||||
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user