You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/guides/jetstream/introduction/getting-started.mdx
+8-5Lines changed: 8 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,14 +14,17 @@ import { Reference } from "../../../../components/markdown/Reference.js";
14
14
import { Jetstream } from"@skyware/jetstream";
15
15
16
16
const jetstream =newJetstream();
17
+
jetstream.start();
17
18
```
18
19
19
20
The `Jetstream` class takes an object parameter with the following properties:
20
21
21
22
-`wantedCollections`: An array of collections to subscribe to events for. This can contain any collection name or wildcard strings such as `app.bsky.feed.*` to receive events for all collections whose name starts with `app.bsky.feed.`. If not provided or empty, you will receive events for all collections.
22
23
-`wantedDids`: An array of DIDs to subscribe to events for. If not provided or empty, you will receive events for all DIDs.
23
24
-`cursor`: The Unix timestamp in microseconds to start listening from. A cursor is included in every event emitted as the `time_us` property. If you don't provide a cursor, the class will start listening from the most recent event.
24
-
-`endpoint`: The subscription URL of the Jetstream instance to connect to. Defaults to `wss://jetstream.atproto.tools/subscribe`.
25
+
-`endpoint`: The subscription URL of the Jetstream instance to connect to. Defaults to `wss://jetstream1.us-east.bsky.network/subscribe`.
26
+
27
+
To begin listening for events, call the <Referenceto="/docs/jetstream/classes/Jetstream#start"type="Method">start</Reference> method.
25
28
26
29
## Handling events
27
30
@@ -47,11 +50,11 @@ import { CommitType } from "@skyware/jetstream";
47
50
48
51
// Listen for all commits, regardless of collection
49
52
jetstream.on("commit", (event) => {
50
-
if (event.commit.type===CommitType.Create) {
53
+
if (event.commit.operation===CommitType.Create) {
51
54
console.log("create in ", event.commit.collection, event.commit.record);
0 commit comments