
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
An RPC wrapper around protobufs that uses websockets and http requests (nodejs)
A basic RPC wrapper around protobuf and websockets to facilitate writing web services and apps.
Features include:
This library is meant to be used in a nodejs runtime. To write clients that run in a
browser, see mprc-web.
mRPC's typescript integration is built around ts-proto generated interfaces and types.
First, add that to your project:
yarn add --dev ts-proto
and install the protobuf compiler so you have the protoc command. Then, you can use these to generate typescript bindings for use with mRPC:
protoc \
--plugin=protoc-gen-ts_proto=./node_modules/.bin/protoc-gen-ts_proto \
--ts_proto_out=./src/gen \
--ts_proto_opt=outputServices=generic-definitions,outputServices=default \
--proto_path=../proto \
../proto/*.proto
Put that in a bash script for convenience to quickly update the typescript whenever you change the .proto files.
Once you have the generated ts-proto types, you can simply import them, import the
mrpc-node library and:
Define a service implementation, and add it to an RpcServer:
import { createServer } from "http";
import { RpcClientChannel, RpcServer } from "netrpc-node";
import {
ClientGreeterClientImpl,
Greeter,
GreeterDefinition,
HelloReply,
HelloRequest
} from "./gen/helloworld"
...
class GreeterServiceImpl implements Greeter {
async SayHello(request: HelloRequest): Promise<HelloReply> {
return {
message: "Hello " + request.name,
}
}
}
...
const httpServer = createServer();
const rpcServer = new RpcServer(httpServer, ORIGIN);
rpcServer.addService<Greeter>(new GreeterServiceImpl(), GreeterDefinition);
Alternatively, you can just use wrapSocket(impl, socket, definition) if you got a client socket some other way.
To create a client, create an RpcClientChannel around a hostname or a Socket object, and pass that into
a ___ClientImpl's constructor:
// Import stuff
const channel = new RpcClientChannel({host: 'http://localhost:8080'});
const client = new GreeterClientImpl(channel);
...
const result = await client.SayHello({name: "Alice"});
See https://github.com/maunvz/mRPC/tree/main/samples for a full example of a server/client nodejs command line.
FAQs
An RPC wrapper around protobufs that uses websockets and http requests (nodejs)
We found that mrpc-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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.