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.4 to 0.8.0

43

lib/server.js

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

var newInspector = self._createIntrospector();
var oldInspector = self._createLegacyIntrospector();
var newInspector = self._createIntrospector(context.constructor.name || "Object");
context._zpc_inspect = newInspector;
self._methods._zpc_inspect = getArguments(newInspector);
context._zerorpc_inspect = newInspector;
self._methods._zerorpc_inspect = getArguments(newInspector);
context._zerorpc_inspect = oldInspector;
self._methods._zerorpc_inspect = getArguments(oldInspector);
self._socket.on("multiplexing-socket/receive", function(event) {

@@ -98,7 +94,8 @@ if(event.name in self._methods) self._recv(event, context);

//Creates the new-school introspector
Server.prototype._createIntrospector = function() {
var results = {};
Server.prototype._createIntrospector = function(contextName) {
var methods = {};
var results = { name: contextName, methods: methods };
for(var name in this._methods) {
results[name] = {
methods[name] = {
doc: "",

@@ -117,28 +114,2 @@

//Creates the old-school introspector
Server.prototype._createLegacyIntrospector = function() {
var self = this;
var methods = _.clone(self._methods);
return function(method, longDoc, reply) {
if(method) {
var key = "method";
var filteredMethods = _.filter(methods, function(args, name) {
return name === method;
});
} else {
var key = "methods";
var filteredMethods = methods;
}
var results = {};
results[key] = _.map(filteredMethods, function(args, name) {
return [name, [_.clone(args), null, null, null], ""];
});
reply(results);
};
}
//Called when a method call event is received

@@ -145,0 +116,0 @@ //event : Object

2

package.json
{
"name": "zerorpc",
"version": "0.7.4",
"version": "0.8.0",
"main": "./index.js",

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

zerorpc-node
============
This is a version of [ZeroRPC](https://github.com/dotcloud/zerorpc-python) for node.js. We have full client and server support for version 3 of the protocol. This project is alpha.
ZeroRPC is a communication layer for distributed systems. zerorpc-node is a port of the original [ZeroRPC](https://github.com/dotcloud/zerorpc-python) for node.js. We have full client and server support for version 3 of the protocol, and clients/servers written in the Python version can communicate transparently with those written in node.js. This project is alpha.

@@ -20,3 +20,3 @@ To install the package:

The constructor takes in a context object with the functions to expose over RPC. Only functions that do not have a leading underscore will be exposed. Each exposed method must take in a callback as the last argument. This callback is called as `callback(error, response, more)` when there is a new update, where error is an error object or string, response is the new update, and more is a boolean specifying whether new updates will be available later.
The constructor takes in a context object with the functions to expose over RPC. Only functions that do not have a leading underscore will be exposed. Each exposed method must take in a callback as the last argument. This callback is called as `callback(error, response, more)` when there is a new update, where error is an error object or string, response is the new update, and more is a boolean specifying whether new updates will be available later. You can also do `callback()` to close a stream response, `callback(response)` to send a non-stream response without an error, or `callback(response, more)` for a response without an error.

@@ -79,8 +79,8 @@ Events:

* `bind(endpoint)` - Binds the server to the specified ZeroMQ endpoint.
* `connect(endpoint)` - Connects the server to the specified ZeroMQ endpoint.
* `bind(endpoint)` - Binds the client to the specified ZeroMQ endpoint.
* `connect(endpoint)` - Connects the client to the specified ZeroMQ endpoint.
* `close()` - Closes the ZeroMQ socket.
* `invoke(method, arguments..., callback)` - Invokes a remote method.
* `method` is the method name.
* `callback` is a method to call when there is an update. This callback is called as `callback(error, response, more)` when there is a new update, where error is an error object, response is the new update, and more is a boolean specifying whether new updates will be available later. You can also do `callback()` to close a stream response, `callback(response)` to send a non-stream response without an error, or `callback(response, more)` for a response without an error.
* `callback` is a method to call when there is an update. This callback is called as `callback(error, response, more)`, where error is an error object, response is the new update, and more is a boolean specifying whether new updates will be available later (i.e. whether the response is streaming).

@@ -87,0 +87,0 @@ Full example:

@@ -224,16 +224,17 @@ // Open Source Initiative OSI - The MIT License (MIT):Licensing

exports.testIntrospector = function(test) {
test.expect(15);
test.expect(16);
rpcClient.invoke("_zpc_inspect", function(error, res, more) {
rpcClient.invoke("_zerorpc_inspect", function(error, res, more) {
test.ifError(error);
test.equal(_.keys(res).length, 9);
test.equal(typeof(res.name), "string");
test.equal(_.keys(res.methods).length, 9);
for(var key in res) {
test.equal(res[key].doc, "");
for(var key in res.methods) {
test.equal(res.methods[key].doc, "");
}
test.deepEqual(res.objectError.args, []);
test.deepEqual(res.add42.args.length, 1);
test.deepEqual(res.add42.args[0].name, "n");
test.deepEqual(res.methods.objectError.args, []);
test.deepEqual(res.methods.add42.args.length, 1);
test.deepEqual(res.methods.add42.args[0].name, "n");
test.equal(more, false);

@@ -240,0 +241,0 @@ test.done();

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