Ejemplo n.º 1
0
        public Task GetAsync(string user)
        {
            // Periodically start broadcasting elapsed times to the user for all his/her stopwatches.
            var subscription = _elapsedInterval
                               .SelectMany(_ => _service.MapElapsedTimesByNameAsync(user))
                               .Subscribe(result => Clients.Caller.BroadcastElapsed(result));

            // Store the timer subscription in order to dispose of it when the connection disconnects.
            var subscriptions = GetOrAddSubscriptions(Context.ConnectionId);

            subscriptions.Add(subscription);

            return(Task.FromResult <object>(null));
        }
 public async Task <Dictionary <string, long> > GetAsync(string user)
 {
     return(await _service.MapElapsedTimesByNameAsync(user));
 }