rpc/src/index.ts

25 lines
517 B
TypeScript
Raw Normal View History

2022-11-14 16:09:02 +00:00
// @ts-ignore
2022-11-27 23:22:49 +00:00
import ProtomuxRPC from "protomux-rpc";
2022-11-14 16:09:02 +00:00
// @ts-ignore
2022-11-27 23:22:49 +00:00
import c from "compact-encoding";
import b4a from "b4a";
2022-11-14 16:09:02 +00:00
2022-11-27 23:22:49 +00:00
const ID = b4a.from("lumeweb");
2022-11-14 16:09:02 +00:00
export default class RPC extends ProtomuxRPC {
2022-11-27 23:22:49 +00:00
constructor(stream: any, options = {}) {
options = {
...{
id: ID,
valueEncoding: c.json,
},
...options,
};
super(stream, options);
}
async request(method: any, value: any | string = "", options = {}) {
2022-11-27 23:22:49 +00:00
return super.request(method, value, options);
}
2022-11-14 16:09:02 +00:00
}