.NET WebSocket Client

TsgcWebSocketClient for .NET — cross-platform WebSocket client supporting .NET Framework 2.0+, .NET Core, .NET 5–9, and .NET Standard. Runs on Windows, Linux, and macOS.

TsgcWebSocketClient (.NET)

C# / .NET port of TsgcWebSocketClient. Same property surface, same events, same class name — published under esegece.sgcWebSockets.

Component class

TsgcWebSocketClient

Protocol

WebSocket — RFC 6455

Platforms

.NET Framework 2.0–4.8, .NET Core 1.0–3.1, .NET 5–9, .NET Standard 1.6 / 2.0

Edition

Standard / Professional / Enterprise

Drop the component, set a few properties, go

The same Host/Port/TLS/OnMessage surface as the Delphi component, idiomatic C#.

using esegece.sgcWebSockets;

var client = new TsgcWebSocketClient();
client.Host = "127.0.0.1";
client.Port = 80;
client.TLS  = true;
client.Options.Parameters = "/ws/";

client.OnConnect    += (conn) => Console.WriteLine("#connected: " + conn.IP);
client.OnDisconnect += (conn, code) => Console.WriteLine("#disconnected: " + code);
client.OnMessage    += (conn, text) => Console.WriteLine(text);
client.OnException  += (conn, ex) => Console.WriteLine("#exception: " + ex.Message);

client.Active = true;
client.WriteData("hello");

What's inside

23 published properties, 8 methods, 16 events — pulled from the component reference.

Connection

Published properties: Active, Host, Port.

Messaging

Published properties: QueueOptions.

Reliability

Published properties: HeartBeat, WatchDog.

Security

Published properties: Proxy, Authentication, TLSOptions.

Lifecycle

Events: OnConnect, OnDisconnect, OnError.

Data

Events: OnMessage, OnBinary, OnFragmented.

Specifications & references

Authoritative sources for the protocols this component implements.

Documentation & Demos

Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.

Online Help — TsgcWebSocketClient Full property, method and event reference for this component.
Demo Project — Demos\NET\WebSocket Client Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below.
Technical Document (PDF) Features, quick start, code samples for Delphi, C++ Builder and .NET and primary-source references — this component only.
User Manual (PDF) Comprehensive manual covering every component in the library.

Ready to Get Started?

Download the .NET library and add WebSocket support to your C# application.