public ClientInvocatorContext(Type invocator, string connectorName, string hostAddress, WebSocketSupportedSchemes scheme = WebSocketSupportedSchemes.WS, string uriPath = "", string query = "", Func <WebSocket, Task> onConnectedAsync = null, Func <WebSocket, Task> onDisconnectedAsync = null) : base(invocator) { ConnectorName = connectorName ?? throw new ArgumentNullException(nameof(connectorName)); HostAddress = hostAddress ?? throw new ArgumentNullException(nameof(hostAddress)); Scheme = scheme; UriPath = uriPath; Query = query; OnConnectedAsync = onConnectedAsync; OnDisconnectedAsync = onDisconnectedAsync; var schemeStr = Scheme == WebSocketSupportedSchemes.WS ? "ws" : "wss"; var uriBuilder = new UriBuilder(new Uri($"{schemeStr}://{HostAddress}")); if (!string.IsNullOrEmpty(UriPath)) { uriBuilder.Path = UriPath; } if (!string.IsNullOrEmpty(Query)) { uriBuilder.Query = Query; } Uri = uriBuilder.Uri; ConnectorKey = $"{ConnectorName}|{HostAddress}|{Invocator.GetHashCode()}"; }
public ConnectorHostPair(string connectorname, string hostAddress, Type invocator) { ConnectorName = connectorname ?? throw new ArgumentNullException(nameof(connectorname)); HostAddress = hostAddress ?? throw new ArgumentNullException(nameof(hostAddress)); Invocator = invocator ?? throw new ArgumentNullException(nameof(invocator)); Key = $"{ConnectorName}|{HostAddress}|{Invocator.GetHashCode()}"; }
public SocketsOptions() { Invocator = typeof(TInvocator); InvocatorTypeHashCode = Invocator.GetHashCode(); }