public ClientProxy GetClientProxy(string showId, string connectionId) { var key = new ClientIdForAShow(connectionId, showId); _clientProxies.TryGetValue(key, out var result); return(result); }
public void EndSubscription(string showId, string connectionId) { var key = new ClientIdForAShow(connectionId, showId); _clientProxies.TryGetValue(key, out var clientProxy); // clientProxy.Dispose(); _clientProxies.Remove(key); }
public async Task StartSubscription(string showId, string clientConnectionId, IEnumerable <string> initialListAsViewedByTheClient) { // protect with critical section? var key = new ClientIdForAShow(clientConnectionId, showId); ClientProxy clientProxy = null; if (!_clientProxies.ContainsKey(key)) { clientProxy = new ClientProxy(showId, clientConnectionId, initialListAsViewedByTheClient, _messagePublisher); _clientProxies[key] = clientProxy; } else { clientProxy = _clientProxies[key]; } // register this client as an observer of a showWatcher var watcher = _reservationsWatcherPool.GetWatcherForShow(showId); await watcher.Start(); await watcher.RegisterClient(clientProxy); }