@jsonjoy.com/reactive-rpc
Version:
Reactive-RPC is a library for building reactive APIs over WebSocket, HTTP, and other RPCs.
22 lines • 757 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.createClient = void 0;
const RpcPersistentClient_1 = require("../common/rpc/RpcPersistentClient");
const channel_1 = require("../common/channel/channel");
const createClient = (codec, url, token) => {
const protocols = [codec.specifier()];
if (token)
protocols.push(token);
const client = new RpcPersistentClient_1.RpcPersistentClient({
codec,
channel: {
newChannel: () => new channel_1.WebSocketChannel({
newSocket: () => new WebSocket(url, protocols),
}),
},
});
client.start();
return client;
};
exports.createClient = createClient;
//# sourceMappingURL=createClient.js.map
;