You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make server-side pre-connection errors observable via a log callback (fix#593) (#595)
Server-side TLS handshake failures (and other pre-connection errors such
as accept failures or hitting max connections) were only written to
stderr by SocketServer::logError, so applications wired to
setOnClientMessageCallback never saw them - unlike the client side,
which reports TLS failures through the Error message callback.
- Add SocketServer::setLogCallback(LogLevel, message): when set, server
log messages are delivered to the callback instead of stderr/stdout.
Applies to WebSocketServer and HttpServer alike.
- Include the client ip and port in the tls accept failure and socket
creation error messages.
- Add a unittest exercising a failed TLS handshake against a wss server
and asserting the error reaches the callback with the peer address.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
By default the server writes internal errors to stderr (and some info messages to stdout). Errors that happen before a connection is fully established — for example a failed TLS handshake when a client presents a bad certificate — cannot be reported through `setOnClientMessageCallback`, since no WebSocket object exists yet at that point.
463
+
464
+
To capture those messages in your application logs, set a log callback. It applies to `WebSocketServer` as well as `HttpServer`. When a callback is set, messages are delivered to it instead of being written to stderr/stdout.
0 commit comments