Files
sor/Server/src/SOR.Networking.WebSocket/WebSocketTransportOptions.cs
T
d21adbc8d0 Add networking foundation — 9-project C# solution (compiles clean)
Implements the modular networking layer for SOR Server:
- SOR.Networking.Abstractions: pure interfaces (ITransport, IClientConnection,
  IMessageSerializer, IMessageDispatcher, IMessageHandler, IEventBus, IClientPush)
- SOR.Networking.WebSocket: ITransport + IClientConnection over System.Net.WebSockets
- SOR.Networking.Nats: IEventBus over NATS.Net (INatsConnection)
- SOR.Networking.Redis: IClientPush over Redis Pub/Sub
- SOR.Shared: ServiceResult<T>, RedisKeys, NatsSubjects, ServerMessage, JSON serializer
- SOR.Shared.Proto: auth.proto with gRPC AuthService contract
- SOR.Gateway: accept loop, auth handshake, dispatcher, Redis push subscriber
- SOR.Auth: stub gRPC handler (placeholder responses)
- SOR.Host: multi-service runner via ENABLED_SERVICES env var; wires all DI

All concrete implementations are wired exclusively in SOR.Host — every transport,
broker, and push implementation can be swapped by changing only Program.cs.

dotnet build SOR.slnx → 0 errors, 0 warnings

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-02-24 21:01:38 -05:00

42 lines
1.5 KiB
C#

namespace SOR.Networking.WebSocket;
/// <summary>
/// Configuration options for the WebSocket transport.
/// Bound from the "WebSocket" section of appsettings.json via IOptions{WebSocketTransportOptions}.
///
/// appsettings.json example:
/// {
/// "WebSocket": {
/// "Path": "/ws",
/// "PingIntervalMs": 30000,
/// "MaxMessageSizeBytes": 65536,
/// "AuthTimeoutMs": 10000
/// }
/// }
/// </summary>
public sealed class WebSocketTransportOptions
{
/// <summary>
/// The URL path the Gateway listens for WebSocket upgrade requests.
/// All other paths are passed through to the normal ASP.NET Core routing pipeline.
/// Default: "/ws"
/// </summary>
public string Path { get; set; } = "/ws";
/// <summary>
/// How often to send a WebSocket ping frame to detect stale connections.
/// RFC 6455 compliant clients respond automatically with a pong.
/// If no pong is received within this interval the connection is considered dead.
/// Default: 30 seconds (30,000 ms)
/// </summary>
public int PingIntervalMs { get; set; } = 30_000;
/// <summary>
/// Maximum allowed size of a single WebSocket message in bytes.
/// Multi-frame messages are assembled up to this limit.
/// Messages exceeding this cause the connection to be closed with code 1009 (too large).
/// Default: 64 KB (65,536 bytes) — sufficient for all current game message types.
/// </summary>
public int MaxMessageSizeBytes { get; set; } = 65_536;
}