I was looking into making a PR for #709 and it seemed the easiest course of action would be to close the connection with an error on the handshake if the connection limit had been reached. However I noticed if the handshake responds with an error and closes the connection the client observables error function doesn't actually get called anymore. I'm guessing it's coming from the refactor on this commit
No matter what response the sendHandshake() method gets from the server here the next() function is always called and not the error.
It does seem the hzRequest() method adds some checking here to see if a response contains an error but only on messages sent after the handshake...perhaps this could be added to the handshake response as well?
This can be verified by connecting with an invalid JWT. The error function here never gets called.
I started diving into it but it's late and I'm tired. I'll look into it more tomorrow.