Closed mikaelkaron closed 7 years ago
@mikaelkaron - This is a very good observation.
It was actually not possible to listen for these events with the current microcule
architecture.
The crux of the issue is that we needed to open an additional STDIO channel 3
to handle HTTP request / response methods. Currently we are handling all response methods over STDERR
which is STDIO channel 2
. This has been long discussed in the hook.io repo with @pyhedgehog ( among others )
Good news, I've now opened up STDIO 3
in the pipe3
branch, and we should now be able to listen for the events you need.
Please feel free to test this branch out. It shouldn't break anything, but I should do further testing downstream to ensure it's not going to break anything. Overall, this was a much needed feature. I'm hoping to eventually migrate our overloaded STDERR
channel to use the new pipe3
.
I'm a bit confused, because this was and has previously been working on hook.io. I don't think we need pipe3
for this?
see:
https://hook.io/examples/javascript-stream-transform https://hook.io/examples/javascript-stream-transform/source
It's still working on hook.io, so maybe it was with a recent version of microcule
which hasn't been deployed or we both experienced the same testing bug.
Going to investigate further.
Yeah, not sure what happened here. There was a disconnect somewhere, but we do have and already had this functionality.
We do have streaming examples checked into the repo which can be tested with curl commands.
I've commented out the pipe3
code for now, but left it in-tact. We should probably use this new code path for migrating from overloading STDERR
with http response methods.
I was wondering how one would go about detecting when a user closes / clicks stop in a loading tab? I found a stack overflow thread on how to do it in vanilla express:
Granted I never tested this myself but I did test it inside a hook but to no avail.