How rrqm/touchsocket works
TouchSocket is a .NET networking framework for building clients, servers, protocol gateways, and RPC/MCP applications. A typical TCP workflow starts with an application configuring a client or service, establishes a connection, receives and frames data through an adapter, and dispatches lifecycle or receive events through plugins. The framework also provides HTTP/WebSocket, messaging and industrial protocols, RPC, memory and serialization primitives, and hosting/DI integrations. The graph preserves these documented capability branches; several are represented at subsystem level because their implementation was not sampled.
Main entry points: TcpSessionClientBase.cs TCP sessions · PluginManager.cs Plugin dispatch · BytesPool Memory and bytes · HttpSessionClient.Http2.cs HTTP and WebSocket
Components 24
Networking transports
- TCP sessions
src/TouchSocket/Components/Tcp/TcpSessionClientBase.cs - Named pipes
src/TouchSocket.NamedPipe/Components/NamedPipeSessionClientBase.cs - Serial ports
src/TouchSocket.SerialPorts/Components/SerialPortClientBase.cs - ASP.NET integration
src/TouchSocket.AspNetCore
Protocols and APIs
- HTTP and WebSocket
src/TouchSocket.Http/Components/HttpSessionClient.Http2.cs - MQTT
src/TouchSocket.Mqtt/Components/WebSocket/MqttWebSocketSessionClient.cs - CoAP
src/TouchSocket.CoAP/Components - Modbus
src/TouchSocket.Modbus/Handlers - HSMS / SECS
src/TouchSocket.Semi/Components/HsmsSessionClient.cs - Socket.IO
src/TouchSocket.SocketIo - RPC
src/TouchSocket.Rpc - DMTP
src/TouchSocket.Dmtp - Web API
src/TouchSocket.WebApi - MCP
src/TouchSocket.Mcp - Redis
src/TouchSocket.Redis
Core runtime
- Data adapters
src/TouchSocket.Core/DataAdapter - Memory and bytes
src/TouchSocket.Core/BytesPool - Configuration and DI
src/TouchSocket.Core/Config/TouchSocketConfig.cs - Plugin dispatch
src/TouchSocket.Core/Plugins/PluginManager.cs - Logging
src/TouchSocket.Core/Logger/ILog.cs - Serialization
src/TouchSocket.Core/Serialization - Source generators
src/TouchSocket.Core.SourceGenerator
Hosting and extensions
- Generic hosting
src/TouchSocket.Hosting
Other components
- Application
Connections 25
- Application → TCP sessions: configures and connects
README.md - TCP sessions → Data adapters: frames received data
src/TouchSocket/Components/Tcp/TcpSessionClientBase.cs - TCP sessions → Plugin dispatch: raises lifecycle events
src/TouchSocket/Components/Tcp/TcpSessionClientBase.cs - Application → Named pipes: uses unified API
README.md - Application → Serial ports: uses unified API
README.md - Application → HTTP and WebSocket: uses protocol API
README.md - Application → MQTT: uses protocol API
README.md - Application → CoAP: uses protocol API
README.md - Application → Modbus: uses protocol API
README.md - Application → HSMS / SECS: uses protocol API
README.md - Application → Socket.IO: uses protocol API
README.md - Application → RPC: registers and invokes
README.md - Application → DMTP: uses protocol API
README.md - Application → Web API: uses server and client
README.md - Application → MCP: uses server or client
README.md - Application → Redis: uses client or server
README.md - Application → Configuration and DI: configures services
README.md - Application → Generic hosting: hosts services
README.md - Application → Source generators: uses generated code
README.md - Data adapters → Memory and bytes: uses pooled buffers
- HTTP and WebSocket → Memory and bytes: writes framed bytes
src/TouchSocket.Http/Components/HttpSessionClient.Http2.cs - Configuration and DI → Plugin dispatch: configures plugins
- Plugin dispatch → Logging: logs events
- Serialization → Memory and bytes: serializes to bytes
- ASP.NET integration → DMTP: hosts WebSocket DMTP
src/TouchSocket.AspNetCore/Dmtp/Components/WebSocketDmtpSessionClient.cs