Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zerorpc

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zerorpc - npm Package Compare versions

Comparing version 0.7.2 to 0.7.3

95

lib/server.js

@@ -42,3 +42,8 @@ // Open Source Initiative OSI - The MIT License (MIT):Licensing

var names = fun.toString().match(m1)[1].replace(m2, '').replace(m3, '').split(',');
return names.length == 1 && !names[0] ? [] : names;
var args = names.length == 1 && !names[0] ? [] : names;
//Remove the last argument from the args becase it is the callback
args.pop();
return args;
}

@@ -58,8 +63,3 @@

if(!/^_/.test(name) && typeof(context[name]) == 'function') {
var args = getArguments(context[name]);
//Remove the last argument from the args becase it is the callback
args.pop();
methods[name] = args;
methods[name] = getArguments(context[name]);
}

@@ -71,15 +71,38 @@ }

//Adds the new-school introspector function to a context
//context : Object
// The object to be exposed
//methods : Object
// The set public methods of the exposed object
function addIntrospector(context, methods) {
// Creates a new server
// context : Object
// The object to expose
function Server(context) {
var self = this;
self._socket = socket.server();
util.eventProxy(self._socket, self, "error");
self._methods = publicMethods(context);
var newInspector = self._createIntrospector();
var oldInspector = self._createLegacyIntrospector();
context._zpc_inspect = newInspector;
self._methods._zpc_inspect = getArguments(newInspector);
context._zerorpc_inspect = oldInspector;
self._methods._zerorpc_inspect = getArguments(oldInspector);
self._socket.on("multiplexing-socket/receive", function(event) {
if(event.name in self._methods) self._recv(event, context);
});
}
nodeUtil.inherits(Server, events.EventEmitter);
//Creates the new-school introspector
Server.prototype._createIntrospector = function() {
var results = {};
for(var name in methods) {
for(var name in this._methods) {
results[name] = {
doc: "",
args: _.map(methods[name], function(arg) {
args: _.map(this._methods[name], function(arg) {
return { name: arg };

@@ -90,5 +113,3 @@ })

methods._zpc_inspect = true;
context._zpc_inspect = function(reply) {
return function(reply) {
reply(results);

@@ -98,14 +119,10 @@ };

//Adds the old-school introspector function to a context
//context : Object
// The object to be exposed
//methods : Object
// The set public methods of the exposed object
function addLegacyIntrospector(context, methods) {
methods._zerorpc_inspect = true;
//Creates the old-school introspector
Server.prototype._createLegacyIntrospector = function() {
var self = this;
context._zerorpc_inspect = function(method, longDoc, reply) {
return function(method, longDoc, reply) {
if(method) {
var key = "method";
var filteredMethods = _.filter(methods, function(args, name) {
var filteredMethods = _.filter(self._methods, function(args, name) {
return name === method;

@@ -115,3 +132,3 @@ });

var key = "methods";
var filteredMethods = methods;
var filteredMethods = self._methods;
}

@@ -129,22 +146,2 @@

// Creates a new server
// context : Object
// The object to expose
function Server(context) {
var self = this;
self._socket = socket.server();
util.eventProxy(self._socket, self, "error");
var methods = publicMethods(context);
addIntrospector(context, methods);
addLegacyIntrospector(context, methods);
self._socket.on("multiplexing-socket/receive", function(event) {
if(event.name in methods) self._recv(event, context);
});
}
nodeUtil.inherits(Server, events.EventEmitter);
//Called when a method call event is received

@@ -214,2 +211,4 @@ //event : Object

return ch.close();
} else if(event.args.length != self._methods[event.name].length) {
return sendError(new Error("Invalid number of arguments"));
}

@@ -216,0 +215,0 @@

{
"name": "zerorpc",
"version": "0.7.2",
"version": "0.7.3",
"main": "./index.js",

@@ -5,0 +5,0 @@ "author": "dotCloud <opensource@dotcloud.com>",

@@ -10,2 +10,4 @@ zerorpc-node

If you get the error `Package libzmq was not found`, take a look at [the fix for zeromq.node](https://github.com/JustinTulloss/zeromq.node/issues/55). If you get the error `Unable to load shared library <<path to zeromq.node>>/binding.node`, [make sure you run ldconfig](https://github.com/JustinTulloss/zeromq.node/issues/85). If that still doesn't work, check out [this ticket](https://github.com/JustinTulloss/zeromq.node/issues/92).
Servers

@@ -12,0 +14,0 @@ -------

@@ -244,6 +244,7 @@ // Open Source Initiative OSI - The MIT License (MIT):Licensing

exports.testIncorrectArgumentCount = function(test) {
test.expect(3);
test.expect(4);
rpcClient.invoke("addMan", function(error, res, more) {
rpcClient.invoke("lazyIter", function(error, res, more) {
test.ok(error);
test.equal(error.message, "Invalid number of arguments");
test.equal(res, null);

@@ -250,0 +251,0 @@ test.equal(more, false);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc