예제 #1
0
        public async Task JoinGroup(string groupname)
        {
            if (!_repository.GroupExists(groupname))
            {
                throw new Exception("Cannot join a group that doesn't exist.");
            }

            await Groups.AddToGroupAsync(Context.ConnectionId, groupname);

            await Clients.Group(groupname).SendAsync("JoinGroup", groupname);

            var history = _repository.GetAllNewsItems(groupname);
            await Clients.Client(Context.ConnectionId).SendAsync("History", history);
        }
예제 #2
0
 public List <NewsItem> CallFeeds(string newsSource)
 {
     return(newsRepository.GetAllNewsItems(appProperties.newsSourcesURLs[newsSource]));
 }