コード例 #1
0
ファイル: PusherService.cs プロジェクト: spetz/Trill.Web
        private async Task SubscribeStoriesAsync()
        {
            var stream = _client.StreamStories(new SubscribeStories());

            while (await stream.ResponseStream.MoveNext(CancellationToken.None))
            {
                var story = stream.ResponseStream.Current;
                StoryCreated?.Invoke(new StoryDto
                {
                    Id        = story.Id,
                    Title     = story.Title,
                    CreatedAt = DateTime.Parse(story.CreatedAt),
                    Author    = new AuthorDto
                    {
                        Id   = Guid.Parse(story.Author.Id),
                        Name = story.Author.Name
                    },
                    Tags = story.Tags
                });
            }
        }