Is there a way to handle the `close` frame receive...
# ktor
g
Is there a way to handle the
close
frame received via a websocket connection? Or is listening to exception the only way to do that (not ideal since I don't listen to frames I just emit them, maybe the
ClosedSendChannelException
works for that but it's not mentioned in the docs)
🦻 1
a
You can either catch the
CancellationException
and
ClosedSendChannelException
in a WebSockets handler or use raw WebSockets to manually send and receive the close frames.
g
When do these exceptions get thrown precisely?
a
The
CancellationException
is thrown when the channel for outgoing frames is cancelled after receiving a close frame.
g
Uh ok thanks