Ejemplo n.º 1
0
        public bool IsObservedBy(ClientProxy clientProxy)
        {
            List <IObserveReservedSeats> observers = null;

            lock (_syncObservers)
            {
                observers = _observers;
            }

            return(observers.Contains(clientProxy));
        }
Ejemplo n.º 2
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);
        }