public IObservable <PeerStatus> AwakeAsObservable() { m_HubConnection = new HubConnectionBuilder() .WithUrl(m_Url + HubConnectionExtensions.Path()) .Build(); m_HubConnection.On(nameof(ReceiveReplicationOp), new Action <string, KSEQOperation <Record> >(ReceiveReplicationOp)); m_HubConnection.On(nameof(ReceiveReplica), new Action <string, List <Atom <Record> > >(ReceiveReplica)); return(m_HubConnection .StartAsync() .ToObservable() .Take(1) .Do(ignored => { peerId = m_HubConnection.GetConnectionId(); }) .Select(ignored => new PeerStatus() { isConnected = m_HubConnection.State == HubConnectionState.Connected })); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseSignalR(routes => { routes.MapHub <THub>(HubConnectionExtensions.Path()); }); }