public ServiceClient(IMemoryChannel channel, IMemoryChannel baseChannel, IHubFactory hubFactory, AsyncBackStream backStream) { this.channel = channel; this.baseChannel = baseChannel; this.hubFactory = hubFactory; this.backStream = backStream; channel.ObjectReceived += IncomingChannelData; channel.ConnectionStatusChanged += LosingConnection; }
/// <summary> /// Initializes a new instance of the ServiceConsumer class /// </summary> /// <param name="serviceAddr">the address of the Hub</param> /// <param name="factory">a hub-connection factory that configures the channel options for this consumer object</param> /// <param name="consumedService">the remote-service that is being consumed</param> /// <param name="customServerSecurity">a security-repo that allows this object to perform user-transformations</param> public InMemoryServiceHubConsumer(string serviceAddr, IHubFactory factory, string consumedService, ICustomServerSecurity customServerSecurity) { channel = new AsyncBackStream(); this.serviceAddr = serviceAddr; this.factory = factory; this.consumedService = consumedService; this.customServerSecurity = customServerSecurity; tickTimer = new Timer(SendTick, null, Timeout.Infinite, Timeout.Infinite); //reconnector = new Timer(ReConnect, null, Timeout.Infinite, Timeout.Infinite); }
public IServiceHubClientChannel CreateClient(string serviceAddr, AsyncBackStream backStream) { MemoryServiceChannel initialChannel = new MemoryServiceChannel(serviceAddr, false, MscMode.Client, 6000, provider); var guid = Guid.NewGuid().ToString("N"); if (initialChannel.IsGlobal) { guid = $@"Global\{guid}"; } var retVal = new MemoryServiceChannel(guid, true, MscMode.Client, 15, provider); ReConnectChannel(retVal, initialChannel); return(new ServiceClient(retVal, initialChannel, this, backStream)); }