httpyac icon indicating copy to clipboard operation
httpyac copied to clipboard

No hook for SSE events

Open cormac-raftery-gea opened this issue 8 months ago • 1 comments

I thought the {{@streaming construct might work as a hook for the SSE events but apparently it doesn't. I guess from looking into the code that SSE does not have a concept of progress which is see is a condition to adding the interceptor. Any plans for how to achieve this for SSE events?

cormac-raftery-gea avatar May 01 '25 09:05 cormac-raftery-gea

the streaming hook is basically there to tell the RequestClient how long the connection will take. If you want to react directly to the messages, you can still attach yourself to the message event. But that depends on the use case you want to achieve.

SSE https://sse.dev/test
Event: message

{{@streaming
  $requestClient.addEventListener("message", (response) => console.info("hook"));

  async function writeStream(){
    await sleep(10000);
  }
  exports.waitPromise = writeStream();
}}

AnWeber avatar May 05 '25 19:05 AnWeber