
Security News
NVD Concedes Inability to Keep Pace with Surging CVE Disclosures in 2025
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
@therms/rpc-server
Advanced tools
A Remote Procedure Call framework for Javascript Node.js written in TS.
The goals of this RPC framework:
Done:
✅ Provide a simple endpoint for clients to make RPC calls
✅ Provide a simple distributed server network of RPC handlers with minimal configuration
Todo:
❌ Provide clients the ability to connect and subscribe to real-time updates via WebSockets
❌ Provide debugging & telemetry on all server info, statistics, status and processes via endpoint
❌ Provide automatic RPC handler API docs for client developers (via telemetry data)
❌ Can optionally serve a telemetry client (html site)
npm i @therms/rpc-gatewayServer
A "gateway server" is an entry-point server. In a distributed cluster of RPC servers, gateway servers are used to provide a transport, HTTP or WebSocket, for clients (ie: browser, mobile app) to make RPC calls.
A basic server that responds on HTTP to requests:
const { RPCServer } = require('@therms/rpc-server');
const server = new RPCServer({
gatewayServer: {
http: { bind: 'localhost', port: 9876 },
displayName: 'rpc-gateway-1',
},
});
server.registerHandler({ procedure: 'login' }, async (request) => {
if (
request.args.email === 'test@test.com' &&
request.args.password === 'secret'
) {
return new CallResponseDTO({
code: 200,
data: { user: { name: 'Test' } },
success: true,
});
} else {
return new CallResponseDTO({
code: 403,
message: 'Auth failed',
success: false,
});
}
});
server.start();
The RPC gateway server will now be available for RPC clients to make HTTP requests at:
POST http://localhost:9876/
body = { procedure: 'test' }
RPC clients can also connect to a RPC gateway server via WebSocket:
const server = new RPCServer({
gatewayServer: {
websocket: { bind: 'localhost', port: 9876 },
displayName: 'rpc-gateway-1',
},
});
Note: Http & WebSocket servers cannot share the same
port
since theHttpServer
in this framework uses Http2 by default. WebSocket's aren't easily supported over Http2, at this time.
A handler server is used in a distributed configuration to provide procedure handlers to handle a specific RPC. Handler servers sit usually behind the firewall and their only communication method with other servers is via message broker. Our example uses RabbitMQ as the message broker.
Note: If a gateway server is running and you expect the gateway server to manage calls to a handler server then the gateway server must be provided with
messageBroker.amqpURI
string so it can connect to the same message broker to communicate with the handler servers.
const { RPCServer } = require('@therms/rpc-server')
const server = new RPCServer({
messageBroker: {
amqpURI: 'http://my-rabbit-mq-host.com'
}
});
server.registerHandler({ procedure: 'get-some-data', scope: 'some-specific-scope' }, async (request) => {
const data = [...] // do some data fetching...
return new CallResponseDTO({
code: 200,
data,
success: true,
});
});
server.start();
The server instance can optionally be configured to collect telemetry information from other servers in the network and serve that data from an endpoint.
new RPCServer({
gatewayServer: {
displayName: 'rpc-gateway-1',
telemetry: {
port: 3000,
},
},
});
Telemetry data can be fetched via the /telemetry
endpoint, ie: GET http://localhost:3000/telemetry
You can optionally serve a static site to view telemetry data via HTML site.
Our example uses the @therms/rpc-telemetry-client
package that is deployed as an NPM package.
Anyone can create their own telemetry client template
const path = require('path');
new RPCServer({
gatewayServer: {
displayName: 'rpc-gateway-1',
telemetry: {
port: 3000,
staticFilesPath: path.resolve(
__dirname,
'../node_modules/@therms/rpc-telemetry-client/build/',
),
},
},
});
This configuration serves the staticSiteUrl
(by proxy) at http:localhost:3000/
FAQs
RPC framework, Node.js lib
The npm package @therms/rpc-server receives a total of 140 weekly downloads. As such, @therms/rpc-server popularity was classified as not popular.
We found that @therms/rpc-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.