public DemoHub( IHubContext<TypedDemoHub, IClient> typedDemoContext, IPersistentConnectionContext<RawConnection> rawConnectionContext) { _typedDemoContext = typedDemoContext; _rawConnectionContext = rawConnectionContext; }
public ConnectionRun(RunData runData) : base(runData) { var connectionManager = new ConnectionManager(Resolver); _context = connectionManager.GetConnectionContext<StressConnection>(); _transportConnection = (ITransportConnection)_context.Connection; }
public DemoHub( IHubContext <TypedDemoHub, IClient> typedDemoContext, IPersistentConnectionContext <RawConnection> rawConnectionContext) { _typedDemoContext = typedDemoContext; _rawConnectionContext = rawConnectionContext; }
public ConnectionRun(RunData runData) : base(runData) { var connectionManager = new ConnectionManager(Resolver); _context = connectionManager.GetConnectionContext <StressConnection>(); _transportConnection = (ITransportConnection)_context.Connection; }
public static void SiganalR(Guid userID, string id, string title, string contents) { IPersistentConnectionContext connectionContext = GlobalHost.ConnectionManager.GetConnectionContext <SignalRConnection>(); JsonData jsonData = new JsonData(); jsonData["id"] = id; jsonData["title"] = title; jsonData["contents"] = contents; jsonData["count"] = new ShortMessage().GetAllNoReadByUserID(userID).Count; connectionContext.Groups.Send(userID.ToString().ToLower(), (object)jsonData.ToJson(), new string[0]); }
private static void StartSendingEvents() { var random = new Random(); if (_context == null) { _context = GlobalHost.ConnectionManager.GetConnectionContext<SensorEventsConnection>(); } _subscription = Observable.Timer(TimeSpan.Zero, TimeSpan.FromMilliseconds(50)) .Select(_ => new SensorEvent() { Reading = random.NextDouble(), SensorId = random.Next(1,4)}) .Subscribe(sensorEvent => _context.Connection.Broadcast(sensorEvent)); }
private static void StartSendingEvents() { var random = new Random(); if (_context == null) { _context = GlobalHost.ConnectionManager.GetConnectionContext <SensorEventsConnection>(); } _subscription = Observable.Timer(TimeSpan.Zero, TimeSpan.FromMilliseconds(50)) .Select(_ => new SensorEvent() { Reading = random.NextDouble(), SensorId = random.Next(1, 4) }) .Subscribe(sensorEvent => _context.Connection.Broadcast(sensorEvent)); }
public void Start() { if (_server == null) { _server = WebApp.Start(_url, app => { var config = new ConnectionConfiguration { Resolver = new DefaultDependencyResolver() }; config.Resolver.Register(typeof(CacheConnection), () => new CacheConnection(this)); _context = config.Resolver.Resolve <IConnectionManager>().GetConnectionContext <CacheConnection>(); app.MapSignalR <CacheConnection>("/cache", config); }); } }
public void Start() { if (_server == null) { _server = WebApp.Start(_url, app => { var config = new ConnectionConfiguration { Resolver = new DefaultDependencyResolver() }; config.Resolver.Register(typeof(CacheConnection), () => new CacheConnection(this)); _context = config.Resolver.Resolve<IConnectionManager>().GetConnectionContext<CacheConnection>(); app.MapSignalR<CacheConnection>("/cache", config); }); } }
static UserRepository() { _idCounter = 1; //Create user colelction and add a default user Users = new List <User> { new User { UserId = 1, UserName = "******", Password = "******", FirstName = "admin", LastName = "admin" } }; PersistentUserConnection = GlobalHost.ConnectionManager.GetConnectionContext <UsersHub>(); }
private static void StartBroadcasting() { if (_context == null) _context = GlobalHost.ConnectionManager.GetConnectionContext<DashboardConnection>(); var data = InitData(100); while (_connections > 0) { Thread.Sleep(1000); try { data = ProgressData(data); _context.Connection.Broadcast(data); } catch {} } }
public async Task SendToGroupFromOutsideOfConnection() { using (var host = new MemoryHost()) { IPersistentConnectionContext connectionContext = null; host.Configure(app => { var configuration = new ConnectionConfiguration { Resolver = new DefaultDependencyResolver() }; app.MapSignalR <BroadcastConnection>("/echo", configuration); connectionContext = configuration.Resolver.Resolve <IConnectionManager>().GetConnectionContext <BroadcastConnection>(); }); var connection1 = new Client.Connection("http://foo/echo"); using (connection1) { var wh1 = new AsyncManualResetEvent(initialState: false); await connection1.Start(host); connection1.Received += data => { Assert.Equal("yay", data); wh1.Set(); }; await connectionContext.Groups.Add(connection1.ConnectionId, "Foo"); await connectionContext.Groups.Send("Foo", "yay"); Assert.True(await wh1.WaitAsync(TimeSpan.FromSeconds(10))); } } }
public async Task SendToGroupsFromOutsideOfConnection() { using (var host = new MemoryHost()) { IPersistentConnectionContext connectionContext = null; host.Configure(app => { var configuration = new ConnectionConfiguration { Resolver = new DefaultDependencyResolver() }; app.MapSignalR <BroadcastConnection>("/echo", configuration); connectionContext = configuration.Resolver.Resolve <IConnectionManager>().GetConnectionContext <BroadcastConnection>(); }); var connection1 = new Client.Connection("http://foo/echo"); using (connection1) { var wh1 = new TaskCompletionSource <object>(); await connection1.Start(host); connection1.Received += data => { Assert.Equal("yay", data); wh1.TrySetResult(null); }; await connectionContext.Groups.Add(connection1.ConnectionId, "Foo"); var ignore = connectionContext.Groups.Send(new[] { "Foo", "Bar" }, "yay"); await wh1.Task.OrTimeout(TimeSpan.FromSeconds(10)); } } }
public SignalREventDispatcher() { _context = GlobalHost.ConnectionManager.GetConnectionContext<Aggregator>(); }
private void Initialize(IConnectionManager connectionManager) { _connectionContext = connectionManager.GetConnectionContext <TConnection>(); }
private BridgerService(IPersistentConnectionContext context) { _context = context; _serverRegistration = new ServerRegistrationService(); _pendingRequests = new ConcurrentDictionary <Guid, PendingRequest>(); }
public PersistentConnectionContextService(IConnectionManager connectionManager) { _connectionContext = connectionManager.GetConnectionContext <TConnection>(); }
public void Startup() { this.Host.Start(); this.connection = GlobalHost.ConnectionManager.GetConnectionContext <SemanticLoggingConnection>(); }
private ChangeState(IPersistentConnectionContext pcc) { Context = pcc; }
public BrewHub(IHubContext <TypedBrewHub, IClient> demoContext, IPersistentConnectionContext <RawConnection> rawConnectionContext) { _context = demoContext; _rawConnectionContext = rawConnectionContext; }
public SignalREventDispatcher() { _context = GlobalHost.ConnectionManager.GetConnectionContext <Aggregator>(); }