Skip to content

Commit 3277bca

Browse files
committed
Update README.md
1 parent 9b2ca96 commit 3277bca

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,23 @@ es.addEventListener("error", (event) => {
5151
}
5252
});
5353

54+
es.addEventListener("done", (event) => {
55+
console.log("Done SSE connection.");
56+
});
57+
5458
es.addEventListener("close", (event) => {
5559
console.log("Close SSE connection.");
5660
});
5761
```
5862

63+
### Done vs Close
64+
65+
`done` events will fire when server closes the connection.
66+
Reconnections will occur indefinitely, unless this behavior is disabled.
67+
`close` events will fire when the connection is terminated by the client, using `.close()`.
68+
69+
### Headers and params
70+
5971
If you want to use Bearer token and/or topics, look at this example (TypeScript):
6072

6173
```typescript

0 commit comments

Comments
 (0)