websocket-driver
websocket-driver copied to clipboard
Emit errors on disconnection
Hi,
There's this nice (on :error ...)
function, but it's never actually used :-)
Specifically, try to connect a client, then unplug your network cable, and you'll see... nothing. Nothing is happening, forever.
Using (wsd:send-ping)
during this time immediately returns NIL
, so we can't use it as a heartbeat either.
How can we handle disconnection cases?
Hm, that's strange and sounds like a bug.
I was bitten by the same bug, but after reviewing the code I cannot understand why the (on :error ...) is not being triggered.
I think the description of the :error event in the readme says clearly that it is for protocol errors regarding malformed messages, I think maybe the right thing to do is to implement an event to catch other kind of errors, it could use some structure containing functions to respond to certain conditions so the users can define their own way to handle this kind of situations, in the implementation you can see that the handler-case
for the error callback states that it is for protocol errors
https://github.com/fukamachi/fast-websocket/blob/24c0217e7c0d25b6ef6ab799452cba0b9fb58f44/src/fast-websocket.lisp#L167
Maybe we could give it a shot.