This SDK-style net472 console project demonstrates client-side settings for
websocket-sharp without opening a connection by default. Run it with no
arguments to print usage and exit.
The example covers:
SslConfiguration.ServerCertificateValidationCallbackforwss://clients. The default accepts only platform-valid certificates.--allow-local-dev-certis an explicit exception for localhost or loopback development endpoints and only allows certificate chain errors.--trusted-thumbprintpins a specific server certificate thumbprint when a development endpoint has a non-standard certificate name.SetProxywith optional proxy credentials.CompressionviaCompressionMethod.Deflate, with--no-compressionto disable the request.ConnectionTimeout.- Bounded opt-in redirects with
EnableRedirectionandMaxRedirections(0..100, default5). Cross-origin redirects omit HTTP credentials, cookies, user headers, and TLS client certificates, including reconnects. Securewss://to insecurews://downgrade remains blocked unless--allow-insecure-redirectis supplied explicitly. OriginandSetUserHeader.
dotnet build .\Examples\SecureAndProxyClient\SecureAndProxyClient.csprojdotnet run --project .\Examples\SecureAndProxyClient\SecureAndProxyClient.csproj -- --help
dotnet run --project .\Examples\SecureAndProxyClient\SecureAndProxyClient.csproj -- wss://localhost:5963/Echo --allow-local-dev-cert
dotnet run --project .\Examples\SecureAndProxyClient\SecureAndProxyClient.csproj -- wss://localhost:5963/Echo --trusted-thumbprint <sha1>
dotnet run --project .\Examples\SecureAndProxyClient\SecureAndProxyClient.csproj -- wss://example.com/Echo --proxy http://localhost:3128
dotnet run --project .\Examples\SecureAndProxyClient\SecureAndProxyClient.csproj -- ws://localhost:4649/Chat --origin http://localhost:4649 --header RequestForID=ID