.NET WebSocket Server

TsgcWebSocketHTTPServer for .NET — an HTTP.SYS-based WebSocket and HTTP server supporting shared ports, SSL/TLS, and high-concurrency connections.

TsgcWebSocketHTTPServer (.NET)

C# / .NET port of TsgcWebSocketHTTPServer. Bind to a port, hook OnMessage, broadcast with WriteData — same surface as the Delphi component.

Component class

TsgcWebSocketHTTPServer

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

Professional / Enterprise

Drop the component, set a few properties, go

Bind to a port, hook OnConnect/OnMessage, then set Active = true.

using esegece.sgcWebSockets;

var server = new TsgcWebSocketHTTPServer();
server.Port = 80;

server.OnConnect        += (conn) => server.WriteData("welcome " + conn.IP);
server.OnMessage        += (conn, text) => server.WriteData(text);
server.OnDisconnect     += (conn, code) => Console.WriteLine("#bye " + conn.IP);
server.OnAuthentication += (conn, user, pass, ref ok) => { ok = (user == "admin" && pass == "s3cret"); };

server.Active = true;

What's inside

27 published properties, 7 methods, 22 events — pulled from the component reference.

Connection

Published properties: Active, Port, Bindings.

Messaging

Methods: Broadcast, WriteData, Ping.

Reliability

Published properties: HeartBeat, WatchDog, LoadBalancer.

Security

Published properties: Authentication, SSL, SSLOptions.

Lifecycle

Events: OnStartup, OnShutdown, OnTCPConnect.

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 — TsgcWebSocketServer Full property, method and event reference for this component.
Demo Project — Demos\NET\WebSocket Server 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 Build Your .NET Server?

Download the library and create a WebSocket server in C# today.