Using bsky.network BGS/relay with the RepoCommitAdaptor #1001
-
After the recent change with bsky.social migrating to multiple PDSs, how can I use the bsky.network's firehose instead of listening to the firehose of our account's PDS? I am following the tutorial "How to Create Bluesky BOT using Dart and Firehose ", and wondering whether this method can be still used to get all events happening in all of bsky.social PDSs. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @Gusty9A ! Thanks for reaching out to me about this. I was not aware of this at all tbh. Well you are right, now that the PDS federation has started we need to connect to the I have released So you can get the whole bsky.social events as follows with the latest versions: import 'package:bluesky/bluesky.dart' as bsky;
Future<void> main() async {
// Now defaults to `bsky.network` for stream endpoint
final bluesky = bsky.Bluesky.anonymous();
final subscription = await bluesky.sync.subscribeRepoUpdates();
subscription.data.stream.listen((event) {
event.when(
commit: bsky.RepoCommitAdaptor(
//! Create events.
onCreatePost: (data) => data.record,
onCreateLike: print,
//! Update events.
onUpdateProfile: print,
//! Delete events.
onDeletePost: print,
).execute,
handle: print,
migrate: print,
tombstone: print,
info: print,
unknown: print,
);
});
} |
Beta Was this translation helpful? Give feedback.
Hi @Gusty9A !
Thanks for reaching out to me about this. I was not aware of this at all tbh.
Well you are right, now that the PDS federation has started we need to connect to the
bsky.network
to get Firehose for the whole bsky.social events.I have released
atproto 0.8.1
andbluesky 0.10.1
to handle this. Since these versions, we will always be connected tobsky.network
by default for stream endpoints. Other than stream, it'sbsky.social
as before.So you can get the whole bsky.social events as follows with the latest versions: