tryretool / retoolrpc

MIT License
6 stars 5 forks source link

Ability to stop listening in JS SDK #23

Closed KATT closed 8 months ago

KATT commented 8 months ago

What

.listen() currently loops forever AFAICT and I can't find any way of stopping it which likely[^1] leads to non-graceful shutdowns.

How

It'd be nice if the SDK would be

const rpc = new RetoolRPC({
  // [...]
});

console.log('Connecting to Retool....');
const stop = await rpc.listen();

console.log('Listening on Retool');

await stop();
console.log('Retool stopped listening');

[^1]: I'm still evaluating if we should be using Retool RPC or continue how we're doing stuff now so I'm not sure it leads to a non-graceful shutdown

huytool157 commented 8 months ago

Noted, will work on adding a stop mechanism soon.

KATT commented 8 months ago

As I mentioned here, it'd be even nicer if it was webhook/push based so we wouldn't have to care about state at all