user1382306
user1382306

Reputation:

Detect invalid certificate for WebSocket

Is it possible to detect that a secure websocket was closed because of an invalid certificate?

If so, how?

Upvotes: 1

Views: 195

Answers (1)

vtortola
vtortola

Reputation: 35905

No, it is not possible.

The client will close with 1006 code:

1006

  1006 is a reserved value and MUST NOT be set as a status code in a
  Close control frame by an endpoint.  It is designated for use in
  applications expecting a status code to indicate that the
  connection was closed abnormally, e.g., without sending or
  receiving a Close control frame.

Also, the onerror handler will be called, but it says nothing about the certificate or other particular problem.

https://www.rfc-editor.org/rfc/rfc6455#section-7.4

Upvotes: 2

Related Questions