0.2.2 • Published 10 months ago

atproto-firehose v0.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

AT Protocol Event Stream Client

A library for subscribing to AT Protocol Event Streams (aka Firehose) and a CLI for streaming Bluesky Social events.

Note: This package is intended to be used with Node.js. Currently, it does not work in the browser.

Installation

npm install atproto-firehose

or

yarn add atproto-firehose

or

pnpm add atproto-firehose

Usage example

import {
  ComAtprotoSyncSubscribeRepos,
  SubscribeReposMessage,
  subscribeRepos,
} from 'atproto-firehose'

const client = subscribeRepos(`wss://bsky.social`, { decodeRepoOps: true })
client.on('message', (m: SubscribeReposMessage) => {
  if (ComAtprotoSyncSubscribeRepos.isCommit(m)) {
    m.ops.forEach((op) => {
      console.log(op.payload)
    })
  }
})

Firehose CLI

This project also provides a CLI tool for streaming from Bluesky Social's firehose.

npx atproto-firehose bsky.social

List posts:

npx atproto-firehose bsky.social -p app.bsky.feed.post

List likes:

npx atproto-firehose bsky.social -p app.bsky.feed.like

List follows:

npx atproto-firehose bsky.social -p app.bsky.graph.follow

List profile changes:

npx atproto-firehose bsky.social -p app.bsky.actor.profile

Author

@kcchu.xyz

License

MIT