Overview
laravel-bluesky provides two WebSocket commands for connecting to Bluesky’s real-time streams.
- Jetstream — Bluesky’s own pre-filtered WebSocket endpoint. Lightweight and JSON-encoded.
- Firehose — the AT Protocol’s raw event stream. Receives every piece of data in DAG-CBOR binary form.
Installation
The WebSocket features require Workerman.Jetstream
Overview
Jetstream is a pre-filtered WebSocket service provided by Bluesky. Because you can filter by collection type or user DID, you can efficiently receive only the events you need.Starting it
Collection filters
Use the-C option to narrow the collections you receive. You can specify multiple values.
DID filters
Use the-D option to receive events only for specific users.
Event handling
The Jetstream command fires Laravel events based on the type of message received.
Create an event listener to handle events.
Firehose
Overview
Firehose is the AT Protocol’s raw event stream. You receive every record operation on the Bluesky network in binary (DAG-CBOR) form.The package decodes DAG-CBOR automatically. In your event listener, data arrives as regular PHP arrays.
Starting it
Event handling
The Firehose command also processes messages using Laravel events.Configuration
You can change the target host and logging settings inconfig/bluesky.php.
.env values:
Combining with Labeler
You can start Jetstream or Firehose alongside a Labeler server. This lets the Labeler use Jetstream or Firehose data when processing labeling requests.For Labeler details, see the Labeler page.
Running long-running processes
WebSocket commands are long-running processes. In production, use a process manager like Supervisor.Example Supervisor configuration
/etc/supervisor/conf.d/bluesky-jetstream.conf:
Laravel Forge daemon configuration
If you use Laravel Forge, add a daemon under the Daemons section.- Command:
php artisan bluesky:ws start -C app.bsky.feed.post - Directory:
/var/www/html - User:
forge
Background processes on Laravel Cloud
Because WebSocket commands connect to Bluesky’s stream as a WebSocket client, they also work on Laravel Cloud. Configure them as a Laravel Cloud background process (custom worker). Add a Custom Worker in your Laravel Cloud background process settings. For Jetstream:Process stop and restart on deploy is handled automatically by Laravel Cloud. No extra configuration beyond the background process setup is required.
Notes
- If a process exits unexpectedly,
autorestart=truerestarts it automatically. - To avoid memory leaks, consider periodic restarts.
- For Firehose, which receives a large volume of messages, offload listener work to an async Queue Job.
Source: src/Console/WebSocket