7 Replies
Do you mean the server or the connection?
If you mean the server, you should use the web-standard
AbortSignal
API:
Oh wow! I thought I found it through unref(), this seems nicer.
How would I close the connection outside the request loop?
You could close the connection outside of the request loop like you'd expect! Just call
controller.abort();
If I have many Deno.servers going on for different ports (which is what I'm doing), how do I map a controller to a specific server?
Oh, I pass the signal instance into the server?
I see. And then how to pass configs with the signal at the same time?
Forgive me, I'm new to Deno and trying to figure it all how.
Presumably you'd want to shut down the servers at different times? If that's the case, I think you got it. If that's not the case, you only need one abort controller!
Thanks so much for helping me with your answers.
Yes, at different times. I can remote send a command to do it. only thing is how to initialize server with the signal and config props at the same time (for port)
Yes, at different times. I can remote send a command to do it. only thing is how to initialize server with the signal and config props at the same time (for port)
Next to the signal, you can specify a port property