Example #1
0
        public async Task GetStatus()
        {
            var count = await HinasukiRepository.GetCount();

            await Clients.Caller.SendAsync("Hinasuki", count);

            await Clients.Caller.SendAsync("UserCount", HinasukiHubValue.UserCount);
        }
Example #2
0
        private async void NotifyTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            if (IsNotify == 0)
            {
                return;
            }

            var count = await HinasukiRepository.GetCount();

            if (OldCount == count)
            {
                Interlocked.Exchange(ref IsNotify, 0);
                return;
            }

            await HinasukiHubContext.Clients.All.SendAsync("Hinasuki", count);

            OldCount = count;
        }