websocket-driver icon indicating copy to clipboard operation
websocket-driver copied to clipboard

Emit errors on disconnection

Open ralt opened this issue 6 years ago • 3 comments

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?

ralt avatar Nov 11 '18 22:11 ralt

Hm, that's strange and sounds like a bug.

fukamachi avatar Aug 09 '19 13:08 fukamachi

I was bitten by the same bug, but after reviewing the code I cannot understand why the (on :error ...) is not being triggered.

rogersm avatar Apr 06 '21 15:04 rogersm

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.

eko234 avatar Jun 11 '21 19:06 eko234