CarpaNet.Jetstream lets you connect to a Bluesky Jetstream instance.
This library is experimental and not stable. Expect issues and bugs!
byte[]? zstdDictionary = null;
if (zstdDictionaryPath != null)
{
zstdDictionary = File.ReadAllBytes(zstdDictionaryPath);
Console.WriteLine($"Loaded zstd dictionary from {zstdDictionaryPath} ({zstdDictionary.Length} bytes)");
}
else if (compress)
{
Console.WriteLine("Warning: --compress specified without --zstd-dictionary. Binary frames will fail to decompress.");
}
using var client = new JetstreamClient(new Uri(endpoint), zstdDictionary);
var options = new JetstreamSubscribeOptions
{
Cursor = cursor,
WantedCollections = collections.Count > 0 ? collections : null,
WantedDids = dids.Count > 0 ? dids : null,
Compress = compress,
};
try
{
await foreach (var evt in client.SubscribeAsync(options, cts.Token))
{
switch (evt.Kind)
{
// ... switch on events...
}
}
}
