node-pm2-events
Advanced tools
Comparing version 1.2.37 to 1.2.38
{ | ||
"name": "node-pm2-events", | ||
"version": "1.2.37", | ||
"version": "1.2.38", | ||
"description": "EventBus for local and decentralized instances of the both for individual nodejs applications and as parts of pm2", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -36,2 +36,8 @@ /* | ||
#sendbox = false; | ||
setSendbox(v) { | ||
this.#sendbox = !!v; | ||
} | ||
/** | ||
@@ -257,3 +263,3 @@ * @param {EventBus} eventBus | ||
) return; | ||
console.log('transport on callback', channel, message) | ||
this.#sendbox && console.log('transport on callback', channel, message) | ||
callback(ch, message.data); | ||
@@ -281,3 +287,3 @@ } catch (e) { | ||
}); | ||
console.log('transport send', channel, message) | ||
this.#sendbox && console.log('transport send', channel, message) | ||
this.#publisher.publish(channel, message); | ||
@@ -308,3 +314,3 @@ } | ||
#onStateChange = (name, state) => { | ||
// console.log(this.#name, name, 'status:', state) | ||
this.#sendbox && console.log(this.#name, name, 'status:', state) | ||
}; | ||
@@ -311,0 +317,0 @@ } |
@@ -11,3 +11,8 @@ /* | ||
#connections = new Map(); | ||
#sendbox = false; | ||
setSendbox(v) { | ||
this.#sendbox = !!v; | ||
} | ||
/** | ||
@@ -44,3 +49,3 @@ * @param {EventBus} eventBus | ||
this.EventBus.on(channel, (message) => { | ||
console.log('ws catch internal', channel, message) | ||
this.#sendbox && console.log('ws catch internal', channel, message) | ||
this.send(message); // catch internal event and send broadcast to connected clients | ||
@@ -79,7 +84,7 @@ this.EventBus.transport.send(channel, message); // send to other server instances | ||
message = this.stringify(message); | ||
console.log('ws send', message) | ||
this.#sendbox && console.log('ws send', message) | ||
for (let connection of this.#connections.values()) try { | ||
connection.socket.send(message); | ||
} catch (e) { | ||
console.error(e) | ||
this.#sendbox && console.error(e) | ||
} | ||
@@ -102,3 +107,3 @@ } | ||
} catch (e) { | ||
console.error(e) | ||
this.#sendbox && console.error(e) | ||
} | ||
@@ -105,0 +110,0 @@ } |
@@ -34,2 +34,5 @@ /* | ||
EventBus.transport.setSendbox(true) | ||
EventBus.websocket.setSendbox(true) | ||
const channelName = 'AweSome'; | ||
@@ -36,0 +39,0 @@ EventBus.transport.on(channelName, (channelName, message) => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38529
823