Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // shared
- export const debuggerProxyContract = contract({
- server: {
- keepAlive: notificationContract({}),
- },
- client: {
- serverStarted: notificationContract({ params: type({ port: number }) }),
- clientConnected: notificationContract({}),
- },
- });
- // client
- const proc = spawn("node", ["server.js"]);
- const { server } = debuggerProxyContract.getServerFromStream(
- NodeJsMessageStream.connectToProcess(proc),
- undefined,
- {
- serverStarted: ({ port }) => {
- // ...
- },
- clientConnected: () => {
- // ...
- }
- }
- );
- // server
- const { client } = debuggerProxyContract.registerServerToStream(
- NodeJsMessageStream.connectToThisProcess(),
- {
- keepAlive: () => {
- timeout.reset();
- },
- }
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement