exocom-dev
Advanced tools
Comparing version 0.13.0 to 0.13.1
@@ -11,3 +11,3 @@ // Generated by LiveScript 1.5.0 | ||
console.log(dim("Exosphere Development Communications server " + version + "\n")); | ||
doc = "Provides Exosphere communication infrastructure services in development mode.\n\nUsage:\n " + name + " [--zmq-port=<port>] [--http-port=<port>]\n " + name + " -h | --help\n " + name + " -v | --version"; | ||
doc = "Provides Exosphere communication infrastructure services in development mode.\n\nUsage:\n " + name + " [EXOCOM_ZMQ_PORT=<port>] [EXOCOM_HTTP_PORT=<port>]\n " + name + " -h | --help\n " + name + " -v | --version"; | ||
onZmqBound = function(port){ | ||
@@ -32,4 +32,4 @@ console.log(dim("Ctrl-C to stop")); | ||
x$.listen({ | ||
zmqPort: options['--zmq-port'] || 4100, | ||
httpPort: options['--http-port'] || 4101 | ||
zmqPort: +process.env.EXOCOM_ZMQ_PORT || 4100, | ||
httpPort: +process.env.EXOCOM_HTTP_PORT || 4101 | ||
}); | ||
@@ -53,10 +53,14 @@ x$.on('routing-setup', function(){ | ||
x$.on('message', function(arg$){ | ||
var messages, receivers, i$, len$, message, results$ = []; | ||
var messages, receivers, i$, len$, message, responseTime, results$ = []; | ||
messages = arg$.messages, receivers = arg$.receivers; | ||
for (i$ = 0, len$ = messages.length; i$ < len$; ++i$) { | ||
message = messages[i$]; | ||
responseTime = ''; | ||
if (message.responseTo) { | ||
responseTime = " (" + (message.responseTime * 1e-6).toFixed(2) + " ms)"; | ||
} | ||
if (message.name === message.originalName) { | ||
console.log(message.sender + " --[ " + message.name + " ]-> " + receivers.join(' and ')); | ||
console.log(message.sender + " --[ " + message.name + " ]-> " + receivers.join(' and ') + responseTime); | ||
} else { | ||
console.log(message.sender + " --[ " + message.originalName + " ]-[ " + message.name + " ]-> " + receivers.join(' and ')); | ||
console.log(message.sender + " --[ " + message.originalName + " ]-[ " + message.name + " ]-> " + receivers.join(' and ') + responseTime); | ||
} | ||
@@ -63,0 +67,0 @@ results$.push(console.log(message.payload)); |
// Generated by LiveScript 1.5.0 | ||
var ClientRegistry, EventEmitter, ListenerSubsystem, MessageSender, ref$, delegate, delegateEvent, debug, ExoCom; | ||
var ClientRegistry, EventEmitter, ListenerSubsystem, MessageCache, MessageSender, nanoseconds, process, ref$, delegate, delegateEvent, debug, ExoCom; | ||
ClientRegistry = require('./client-registry/client-registry'); | ||
EventEmitter = require('events').EventEmitter; | ||
ListenerSubsystem = require('./listener-subsystem/listener-subsystem'); | ||
MessageCache = require('./message-cache/message-cache'); | ||
MessageSender = require('./message-sender/message-sender'); | ||
nanoseconds = require('nanoseconds'); | ||
process = require('process'); | ||
ref$ = require('rails-delegate'), delegate = ref$.delegate, delegateEvent = ref$.delegateEvent; | ||
@@ -15,4 +18,5 @@ debug = require('debug')('exocom'); | ||
this.getConfig = bind$(this, 'getConfig', prototype); | ||
this.clientRegistry = new ClientRegistry; | ||
this.listenerSubsystem = new ListenerSubsystem(this); | ||
this.clientRegistry = new ClientRegistry; | ||
this.messageCache = new MessageCache(); | ||
this.messageSender = new MessageSender; | ||
@@ -50,3 +54,3 @@ delegate('close', 'listen', 'zmqPort', 'httpPort', { | ||
ExoCom.prototype.sendMessage = function(messageData){ | ||
var sender, externalMessageName, subscribers, subscriberNames, res$, i$, len$, subscriber, sentMessages; | ||
var sender, externalMessageName, subscribers, subscriberNames, res$, i$, len$, subscriber, originalTimestamp, sentMessages; | ||
sender = this.clientRegistry.clients[messageData.sender]; | ||
@@ -56,2 +60,3 @@ externalMessageName = this.clientRegistry.outgoingMessageName(messageData.name, sender); | ||
messageData.name = externalMessageName; | ||
messageData.timestamp = nanoseconds(process.hrtime()); | ||
subscribers = this.clientRegistry.subscribersTo(externalMessageName); | ||
@@ -64,2 +69,8 @@ res$ = []; | ||
subscriberNames = res$; | ||
if (messageData.responseTo) { | ||
originalTimestamp = this.messageCache.getOriginalTimestamp(messageData.id); | ||
messageData.responseTime = messageData.timestamp - originalTimestamp; | ||
} else { | ||
this.messageCache.push(messageData.id, messageData.timestamp); | ||
} | ||
debug("sending '" + messageData.name + "' to " + subscriberNames); | ||
@@ -66,0 +77,0 @@ sentMessages = this.messageSender.sendToServices(messageData, subscribers); |
@@ -69,3 +69,3 @@ // Generated by LiveScript 1.5.0 | ||
ZMQListener.prototype._parseRequest = function(req){ | ||
var sender, name, payload, responseTo, id; | ||
var sender, name, payload, responseTo, timestamp, id; | ||
sender = req.sender; | ||
@@ -75,9 +75,11 @@ name = req.name; | ||
responseTo = req.responseTo; | ||
timestamp = req.timestamp; | ||
id = req.id; | ||
return { | ||
sender: sender, | ||
id: id, | ||
name: name, | ||
payload: payload, | ||
responseTo: responseTo, | ||
payload: payload, | ||
id: id | ||
sender: sender, | ||
timestamp: timestamp | ||
}; | ||
@@ -84,0 +86,0 @@ }; |
// Generated by LiveScript 1.5.0 | ||
var EventEmitter, zmq, debug, MessageSender; | ||
var EventEmitter, MessageCache, zmq, debug, MessageSender; | ||
EventEmitter = require('events').EventEmitter; | ||
MessageCache = require('../message-cache/message-cache'); | ||
zmq = require('zmq'); | ||
@@ -47,5 +48,7 @@ debug = require('debug')('exocom:message-sender'); | ||
id: messageData.id, | ||
payload: messageData.payload | ||
payload: messageData.payload, | ||
timestamp: messageData.timestamp | ||
}; | ||
if (messageData.responseTo) { | ||
requestData.responseTime = messageData.responseTime; | ||
requestData.responseTo = messageData.responseTo; | ||
@@ -52,0 +55,0 @@ } |
{ | ||
"name": "exocom-dev", | ||
"version": "0.13.0", | ||
"version": "0.13.1", | ||
"author": "Kevin Goslar", | ||
@@ -11,5 +11,7 @@ "dependencies": { | ||
"express": "4.14.0", | ||
"nanoseconds": "0.1.0", | ||
"nitroglycerin": "1.1.2", | ||
"rails-delegate": "0.6.2", | ||
"remove-value": "1.0.0", | ||
"wait": "0.1.0", | ||
"zmq": "2.15.3" | ||
@@ -19,20 +21,20 @@ }, | ||
"devDependencies": { | ||
"async": "2.0.0-rc.6", | ||
"async": "2.1.2", | ||
"chai": "3.5.0", | ||
"cucumber": "1.2.1", | ||
"cucumber": "1.3.1", | ||
"cucumber-snippets-livescript": "1.0.1", | ||
"dependency-lint": "4.0.2", | ||
"dependency-lint": "4.1.5", | ||
"dim-console": "0.4.4", | ||
"exosphere-shared": "0.8.15", | ||
"jsdiff-console": "2.2.1", | ||
"livescript": "1.5.0", | ||
"mocha": "2.5.3", | ||
"mocha-circleci-reporter": "0.0.1", | ||
"node-uuid": "1.4.7", | ||
"o-tools": "0.4.16", | ||
"o-tools-livescript": "1.1.2", | ||
"observable-process": "2.1.0", | ||
"mocha": "3.1.2", | ||
"mocha-circleci-reporter": "0.0.2", | ||
"o-tools": "0.7.0", | ||
"o-tools-livescript": "1.2.3", | ||
"observable-process": "3.2.0", | ||
"port-reservation": "0.3.2", | ||
"prelude-ls": "1.1.2", | ||
"record-http": "0.6.0", | ||
"request": "2.72.0", | ||
"wait": "0.1.0" | ||
"record-http": "0.6.1", | ||
"request": "2.75.0" | ||
}, | ||
@@ -39,0 +41,0 @@ "engines": { |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances 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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
32187
14
789
1
29
11
2
+ Addednanoseconds@0.1.0
+ Addedwait@0.1.0
+ Addednanoseconds@0.1.0(transitive)
+ Addedwait@0.1.0(transitive)