Пример #1
0
        public ClientProxy GetClientProxy(string showId, string connectionId)
        {
            var key = new ClientIdForAShow(connectionId, showId);

            _clientProxies.TryGetValue(key, out var result);

            return(result);
        }
Пример #2
0
        public void EndSubscription(string showId, string connectionId)
        {
            var key = new ClientIdForAShow(connectionId, showId);

            _clientProxies.TryGetValue(key, out var clientProxy);

            // clientProxy.Dispose();

            _clientProxies.Remove(key);
        }
Пример #3
0
        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);
        }