namespace MxGateway.Server.Workers; public sealed class WorkerClientConnection { public WorkerClientConnection( string sessionId, string nonce, Stream stream, WorkerFrameProtocolOptions frameOptions, WorkerProcessHandle? processHandle = null) { if (string.IsNullOrWhiteSpace(sessionId)) { throw new ArgumentException("Session id is required.", nameof(sessionId)); } if (string.IsNullOrWhiteSpace(nonce)) { throw new ArgumentException("Worker nonce is required.", nameof(nonce)); } SessionId = sessionId; Nonce = nonce; Stream = stream ?? throw new ArgumentNullException(nameof(stream)); FrameOptions = frameOptions ?? throw new ArgumentNullException(nameof(frameOptions)); ProcessHandle = processHandle; } public string SessionId { get; } public string Nonce { get; } public Stream Stream { get; } public WorkerFrameProtocolOptions FrameOptions { get; } public WorkerProcessHandle? ProcessHandle { get; } }