
Product
Introducing Data Exports
Export Socket alert data to your own cloud storage in JSON, CSV, or Parquet, with flexible snapshot or incremental delivery.
Connect to (and, if needed, fire up) a daemon with exposed asynchronous API and share or cache data across clients.
Connect to (and, if needed, fire up) a daemon with exposed asynchronous API and share or cache data across clients.
APID fits your needs if you want to split your node.js code to
apidnpm isntall apid --save
var apid = require('apid'), // apid library
server = apid.server; // apid.server instance
// example API
var math = {
sum: function(a, b, callback) {
callback.remote.version(function (err, caller_version) {
callback(null, a + b, '*' + caller_version + '*');
});
}
}
// expose API before starting the service
server.expose({math: math});
// starting server 'my-daemon-name-id'
server.start('my-daemon-name-id', function (err) {
// ready and listening. Outputs are redirected to files in:
// ~/.config/my-daemon-name-id/apid-$UID.[err|out]
console.log('started');
});
var apid = require('apid'), // apid library
client = apid.client('my-daemon-name-id'); // apid client instance
// expose API on the client. This can be called from the daemon.
client.expose('version', function (callback) {
callback(null, '1.0.0');
});
// connect (and fire up daemon if not running yet)
client.connect(__dirname + '/daemon-entry.js', function (err) {
// ready and connected to apid server. Call a remote method:
client.remote.math.sum(1, 3, function (err, sum, caller_version) {
console.log('This should be 4:', sum);
console.log('Caller version returned:', caller_version);
});
});
Returns newly created or existing named client
Connects to APID daemon as a client, fires up the daemon if not running yet
Useful options:
Server instance. Utilize it for creating daemons.
Fires up daemon
Subscribes for "client is connected" event. This happens: - every time a client is connected and has fully exposed its features to the server, and - right before the server sends acknowledge message to client Callback function has exactly one argument: a metafunction that has exactly the same interface as regular callbacks (cb.remote, cb.session) but will do nothing when called itself as cb()
Exposes a function (or functions on an object) to make them available for connecting peers on the .remote object Asynchronous alert:
callback(err[, arg1[, arg2, ...]]); where err is an Error type or null or undefined if there was no error.
Note: available on both client and apid.server instances.Add keys and values to apid.session you want to share. Be careful not to add too much, this will be distributed in connection time. Note:
Container of exposed API on remote peer. See example daemon-entry.js above.
Returns daemon status in a callback. Callback signiture is: (err, pid) where err will be null or an Error object (if daemon is not running) and pid will be null or process ID of the daemon
Ping remote
Trigger remote's console.log() on client
Trigger remote's console.error() on client
node my-client.js --daemon-start
This will exit after daemon is started. E.g. your code will run until the client connects.
node my-client.js --daemon-stop
This will exit after daemon is started. E.g. your code will run until the client connects.
node my-client.js --daemon-kill
This will exit after daemon is started. E.g. your code will run until the client connects.
node my-client.js --daemon-restart
This will NOT exit after (re)starting daemon. E.g. your code will continue running after the status was output.
node my-client.js --daemon-reload
This will NOT exit after (re)loading daemon. E.g. your code will continue running after the status was output.
node my-client.js --daemon-status
This will exit after daemon is started. E.g. your code will run until the client connects.
node my-client.js --daemon-stdout --daemon-stderr
FAQs
Connect to (and, if needed, fire up) a daemon with exposed asynchronous API and share or cache data across clients.
The npm package apid receives a total of 6 weekly downloads. As such, apid popularity was classified as not popular.
We found that apid 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.

Product
Export Socket alert data to your own cloud storage in JSON, CSV, or Parquet, with flexible snapshot or incremental delivery.

Research
/Security News
Bitwarden CLI 2026.4.0 was compromised in the Checkmarx supply chain campaign after attackers abused a GitHub Action in Bitwarden’s CI/CD pipeline.

Research
/Security News
Docker and Socket have uncovered malicious Checkmarx KICS images and suspicious code extension releases in a broader supply chain compromise.