Overview
laravel-bluesky provides two WebSocket commands for connecting to Bluesky’s real-time streams.
- Jetstream — Bluesky’s own filtered WebSocket endpoint. Delivers JSON messages and supports collection and DID filtering.
- Firehose — The raw AT Protocol event stream. Delivers every event on the network in DAG-CBOR binary format.
WebSocket commands are long-running processes that require a VPS, EC2, or any always-on server, or a Laravel Cloud custom worker. They do not work on serverless platforms such as Laravel Vapor or Vercel.
Installation
WebSocket support requires Workerman.
Jetstream
Overview
Jetstream is Bluesky’s managed WebSocket service. You can filter by collection type or user DID, so your process only receives the events you care about.
| Feature | Details |
|---|
| Format | JSON |
| Filtering | Filter by collection and DID |
| Volume | Low to moderate (depending on filters) |
| Use case | Monitor posts, likes, follows, etc. |
Start the command
Collection filter
Use -C to restrict which collections you receive. Pass the flag multiple times for multiple collections.
Common collections:
| Collection | Content |
|---|
app.bsky.feed.post | Post create / delete |
app.bsky.feed.like | Likes |
app.bsky.feed.repost | Reposts |
app.bsky.graph.follow | Follows |
app.bsky.graph.block | Blocks |
DID filter
Use -D to receive events from specific users only.
Event handling
The Jetstream command fires Laravel events based on the message kind.
| Event class | When fired |
|---|
JetstreamMessageReceived | Every received message |
JetstreamCommitMessage | Record create, update, or delete |
JetstreamIdentityMessage | Identity events (handle changes, etc.) |
JetstreamAccountMessage | Account activation or deactivation |
Create a listener to handle events.
Firehose
Overview
Firehose is the raw AT Protocol event stream. It delivers every record operation on the Bluesky network as a binary DAG-CBOR payload. The package decodes the binary data automatically, so your listeners receive standard PHP arrays.
| Feature | Details |
|---|
| Format | DAG-CBOR binary (decoded automatically) |
| Filtering | None — receives all events |
| Volume | Very high |
| Use case | Full data collection, archiving |
DAG-CBOR decoding is handled by the package. Your event listeners receive decoded PHP arrays.
Start the command
Event handling
The Firehose command fires the following Laravel events.
| Event class | When fired |
|---|
FirehoseMessageReceived | Every received message (includes raw binary) |
FirehoseCommitMessage | Record create, update, or delete |
FirehoseIdentityMessage | Identity events |
FirehoseAccountMessage | Account events |
FirehoseSyncMessage | Repository sync events |
Configuration
Adjust the host and logging settings in config/bluesky.php.
Example .env overrides:
Combining with Labeler
You can run the Labeler server alongside Jetstream or Firehose to feed incoming events directly into your labeling logic.
Running as a long-lived process
WebSocket commands must run continuously. Use a process manager such as Supervisor to keep them alive.
Supervisor configuration
/etc/supervisor/conf.d/bluesky-jetstream.conf:
Laravel Forge daemon
In Laravel Forge, add a daemon from the Daemons section.
- Command:
php artisan bluesky:ws start -C app.bsky.feed.post
- Directory:
/var/www/html
- User:
forge
Laravel Cloud background process
Because these commands act as WebSocket clients that connect to Bluesky’s streams (rather than WebSocket servers), they run on Laravel Cloud. Configure them as custom workers in the Laravel Cloud background processes settings.
Add a Custom Worker for each command you want to run.
For Jetstream:
For Firehose:
Laravel Cloud automatically handles process lifecycle during deployments. No additional configuration beyond adding the background process is required.
Tips
- With
autorestart=true, Supervisor restarts the process automatically if it crashes.
- Consider periodic restarts to prevent memory growth over time.
- For the high-volume Firehose stream, dispatch a Queue Job from your listener instead of processing inline.