How to catch process exist from channel?

I am starting a stream in a channel, as:

stream = path
|> File.stream!()
|> CSVParser.parse_stream()

{:ok, pid} = Task.start_link(Stream, :run, [stream])

but how would I catch the down message of process exist? what would be the equivalent of GenServer: def handle_info({:DOWN, _, :process, _pid, reason}, state) in a channel module?

Perhaps its handle_info/2

There’s not much in the doc but it’s there so it is meant for public use.

FYI, if you Task.start_link a process inside of a channel and that task crashes, it’s going to kill the channel because you’re linking the task to the channel.

Thanks, I think I will start it in a genserver, crashing the channel is problem! But, wouldn’t supervisor create a new one?

Why not use a monitor instead? Also as I already pointed out… Phoenix.Channel has a callback handle_info/2

And yes Supervisor would create a new channel (if suervised) but its starts from a fresh state, so it’ll probably loose all connected users as well. If thats a problem in your use case is up to you…