@jsonjoy.com/reactive-rpc
Version:
Reactive-RPC is a library for building reactive APIs over WebSocket, HTTP, and other RPCs.
25 lines • 882 B
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EncodedStaticRpcClient = void 0;
class EncodedStaticRpcClient {
constructor({ send, msgCodec, reqCodec, resCodec = reqCodec, client }) {
this.client = client;
client.onsend = async (messages) => {
const buf = msgCodec.encode(reqCodec, messages);
const res = await send(buf);
const resultMessages = msgCodec.decodeBatch(resCodec, res);
return resultMessages;
};
}
call$(method, data) {
return this.client.call$(method, data);
}
async call(method, request) {
return this.client.call(method, request);
}
notify(method, data) {
this.client.notify(method, data);
}
}
exports.EncodedStaticRpcClient = EncodedStaticRpcClient;
//# sourceMappingURL=EncodedStaticRpcClient.js.map