diff --git a/samples/FishyFlip.Firehose/Program.cs b/samples/FishyFlip.Firehose/Program.cs index e0599144..1641ea2f 100644 --- a/samples/FishyFlip.Firehose/Program.cs +++ b/samples/FishyFlip.Firehose/Program.cs @@ -13,20 +13,24 @@ var debugLog = new DebugLoggerProvider(); // You can set a custom url with WithInstanceUrl -var atProtocolBuilder = new ATWebSocketProtocolBuilder() +var atWebProtocolBuilder = new ATWebSocketProtocolBuilder() + .WithLogger(debugLog.CreateLogger("FishyFlipDebug")); +var atWebProtocol = atWebProtocolBuilder.Build(); + +var atProtocolBuilder = new ATProtocolBuilder() .WithLogger(debugLog.CreateLogger("FishyFlipDebug")); var atProtocol = atProtocolBuilder.Build(); -atProtocol.OnSubscribedRepoMessage += (sender, args) => +atWebProtocol.OnSubscribedRepoMessage += (sender, args) => { Task.Run(() => HandleMessageAsync(args.Message)).FireAndForgetSafeAsync(); }; -await atProtocol.StartSubscribeReposAsync(); +await atWebProtocol.StartSubscribeReposAsync(); var key = Console.ReadKey(); -await atProtocol.StopSubscriptionAsync(); +await atWebProtocol.StopSubscriptionAsync(); async Task HandleMessageAsync(SubscribeRepoMessage message) { @@ -50,11 +54,14 @@ async Task HandleMessageAsync(SubscribeRepoMessage message) { // The Actor Did. var did = message.Commit.Repo; + + var repo = (await atProtocol.Repo.DescribeRepoAsync(did)).HandleResult(); + // Commit.Ops are the actions used when creating the message. // In this case, it's a create record for the post. // The path contains the post action and path, we need the path, so we split to get it. var url = $"https://bsky.app/profile/{did}/post/{message.Commit.Ops![0]!.Path!.Split("/").Last()}"; - Console.WriteLine($"Post URL: {url}"); + Console.WriteLine($"Post URL: {url}, from {repo.Handle}"); } } } \ No newline at end of file