Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Multi-node provides launching of multiple NodeJS processes for TCP/HTTP serving. With multi-node it is very simple to add utilize multiple processes to concurrently serve HTTP requests, simply pass an http.Server object to the listen function:
Multi-node provides launching of multiple NodeJS processes for TCP/HTTP serving. With multi-node it is very simple to add utilize multiple processes to concurrently serve HTTP requests, simply pass an http.Server object to the listen function:
var server = require("http").createServer(function(request, response){
... standard node request handler ...
});
var nodes = require("multi-node").listen({
port: 80,
nodes: 4
}, server);
The listen function takes two arguments, the first is the options, the second is the server. The options argument may have the following properties:
The object returned from the listen function also provides some useful capabilities. The return object has an "isMaster" property indicating if the current process is the original initiating master process. This can be used like:
var nodes = require("multi-node").listen(...);
if(nodes.isMaster){
// start a repl on just one process
require("repl").start();
}
The returned object also provides an "id" property with an id for the current process (each node/process has a unique id).
Multi-node also provides critical inter-process communication facilities. For any web application that requires processes to be able to communicate with each other (for sending messages like in chat applications, or for doing in-memory sessions, etc.), it is necessary for each process to be able to communicate with other processes. The returned object is also an event emitter, and the "node" event is fired for each other node process that is created. The event handler is a passed a readable and writable stream that can be used to communicate with the other process. For example:
var nodes = require("multi-node").listen(...);
var allStreams = [];
nodes.addListener("node", function(stream){
stream.addListener("data", function(data){
... receiving data from this other node process ...
});
allStreams.push(stream);
});
function notifyOtherProcesses(message){
allStreams.forEach(function(stream){
stream.write(message);
});
}
The stream object returned from the "node" event for cross-process communication can be a bit unwieldy to work with by itself, since the stream events can break data up in non-deterministic fashion, and works at the binary level. You can use multi-node's framing mechanism to simplify this. Use the frameStream() function to transform a raw stream into a framed stream that follows the WebSocket API. With this API you can send strings, objects, and other values with the send(value) function and receive these values by listening for the "message" event:
nodes.addListener("node", function(stream){
stream = require("multi-node").frameStream(stream);
stream.addListener("message", function(data){
... receiving string, object, or other value from the other node process ...
});
stream.send({foo:"bar"});
});
Node doesn't support fd passing windows yet, so mult-process delegation doesn't work on windows.
Multi-node is part of the Persevere project, and therefore is licensed under the AFL or BSD license. The Persevere project is administered under the Dojo foundation, and all contributions require a Dojo CLA.
FAQs
Multi-node provides launching of multiple NodeJS processes for TCP/HTTP serving. With multi-node it is very simple to add utilize multiple processes to concurrently serve HTTP requests, simply pass an http.Server object to the listen function:
The npm package multi-node receives a total of 5 weekly downloads. As such, multi-node popularity was classified as not popular.
We found that multi-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.