Fork me on GitHub
#dev-tooling
<
2024-03-08
>
mauricio.szabo01:03:56

Hi, folks! A question: suppose I want to have a middleware that sends REPL-side events - like, for example, a message that a promise in JS resolved, or that a breakpoint was hit. What should be the "recommended", if that exists, way of doing it? Sending back a message with some op field? Something else?

jpmonettas13:03:43

Hi Mauri! afaik nRepl is a request/multi-response protocol, with nothing for server sent events, so maybe a new op for polling events is your only option?

jpmonettas13:03:29

or maybe a long polling system is a little bit more efficient, but I guess that depends on clients and servers timeouts handling

jpmonettas13:03:55

what I would try is to add a middleware with a subscribe-to-events op that will send multiple responses but never send one with a :status :done . As events occur you keep sending back responses. On the client side call subscribe-to-events once after the client connects and dispatch all events client side for every response returned

mauricio.szabo01:03:26

For now, the only thing that I saw that sent me REPL-side events were STDOUT and STDERR, but they just added some fields to a message and that's it...