I would like to be able to execute some code just after having sent a response.
I’m generating an image, that should be sent, removed afterwards.
If I do it on the register_before_send, it will fail because the file is streamed (using send_file).
I would like to avoid doing a send_after since I’m not really sure in how much time a file can be sent.
also, loading the image into memory is somehting I would like to avoid.
I was thinking about this solution actually (monitoring the HTTP process), but I wanted to be sure that I didn’t miss some kind (Hoping) of underdog hook on Phoenix…
I really don’t want to read the file, it might be several MB…
Ok, so on the advice of @benwilson512 I have ended doing a spawn on the controller with a function monitoring the process controlling the socket… as soon as I receive the {:DOWN, …} I do my stuff