示例#1
0
 public ClientWebSocketConnectorOfT(IServiceProvider serviceProvider,
                                    IClientInvocatorContextFactory <TInvocator> invocatorContextFactory,
                                    IStreamCompressor compressor,
                                    ILoggerFactory loggerFactory)
     : base(serviceProvider, compressor, loggerFactory)
 {
     _invocatorContextFactory = invocatorContextFactory ?? throw new ArgumentNullException(nameof(invocatorContextFactory));
     InvocatorContext         = _invocatorContextFactory.CreateInvocatorContext();
 }
示例#2
0
        public static void EnsureHostPair(ClientInvocatorContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var invocator     = context.Invocator;
            var connectorName = context.ConnectorName;
            var hostAddress   = context.HostAddress;

            EnsureHostPair(invocator, connectorName, hostAddress);
        }
示例#3
0
        public ClientInvocatorContext CreateInvocatorContext()
        {
            var context = new ClientInvocatorContext(_proxyOptions.Invocator, _proxyOptions.ConnectorName, _proxyOptions.WebSocketHostAddress);

            if (_proxyOptions.OnConnectedAsync != null)
            {
                context.OnConnectedAsync = _proxyOptions.OnConnectedAsync;
            }

            if (_proxyOptions.OnDisconnectedAsync != null)
            {
                context.OnDisconnectedAsync = _proxyOptions.OnDisconnectedAsync;
            }

            return(context);
        }