Previously asked on the mailing list. Opening an issue to submit a PR.
Tunnel implementations (WebSocket and HTTP) only handle the closing flow once. It's not that they're not re-usable, but if they are in a CLOSED state and another connect() call is issued, it doesn't handle the second failure properly. Making it impossible to automatically know about a subsequent error.
On the second failure, the onerror and onstatechange callbacks are not called. For example, this is log output of the behavior:
I was wondering how the Guacamole application handles this since it does work as expected. I saw that it doesn't really re-use the client, but creates a new one.