• Yes, requires OpenSSL
  • No, only Blocking mode
  • Yes, Requires Win8.+

WebSockets Verify Certificate

If TLS is enabled by sgcWebSockets client, by default certificate server is accepted and not verified. If certificate verification is required, follow next steps:


1. Handle OnSSLAfterCreateHandler event on client component and enable verification:


procedure TfrmWebSocketClient.WSClientSSLAfterCreateHandler(Sender: TObject; aType: TwsSSLHandler; aSSLHandler: TIdSSLIOHandlerSocketBase);


  TIdSSLIOHandlerSocketOpenSSL(aSSLHandler).SSLOptions.VerifyMode := [sslvrfPeer];

  TIdSSLIOHandlerSocketOpenSSL(aSSLHandler).OnVerifyPeer := OnVerifyPeerEvent



2. Create a new method to access server certificate info and accept connection or not


function OnVerifyPeerEvent(Certificate: TIdX509; AOk: Boolean; ADepth, AError: Integer): Boolean;


  // if certificate is valid

  AOk := True;

  // if not is valid

  AOk := False;