Skip to content

Commit 7244879

Browse files
authored
Merge pull request #114 from MatthewWid/feat/public-adapters
Add public connection adapters
2 parents 8f7c1fb + 7089382 commit 7244879

22 files changed

+1050
-227
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
### Added
11+
12+
* Added support for passing custom [connection adapters](https://matthewwid.github.io/better-sse/guides/connection-adapters/) to the `Session` constructor that enables compatibility with any protocol, framework or runtime environment.
13+
1014
### Changed
1115

1216
* Update event ID generation to use `randomUUID` from the [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID) instead of [`node:crypto`](https://nodejs.org/api/crypto.html).
17+
* Update Node HTTP/1 and HTTP/2 Compatibility adapters to [disable Nagle's algorithm](https://nodejs.org/docs/latest/api/net.html#socketsetnodelaynodelay) on the underlying socket to reduce latency.
1318

1419
### Fixed
1520

1621
* Fixed [a warning](https://nodejs.org/api/events.html#emittersetmaxlistenersn) being printed by the Node internals when adding more than ten listeners to events emitted by sessions and channels.
22+
* Fixed a crash that occurred when the request had no `Host` header when using the [Node HTTP/1](https://nodejs.org/api/http.html) or [Node HTTP/2 Compatibility](https://nodejs.org/api/http2.html#compatibility-api) API.
1723

1824
## 0.15.1 - 2025-05-26
1925

docs/astro.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default defineConfig({
2121
"guides/getting-started",
2222
"guides/channels",
2323
"guides/batching",
24+
"guides/connection-adapters",
2425
],
2526
},
2627
{
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import StatusCodeDescription from './status-code-description.mdx'
2+
import HeadersDescription from './headers-description.mdx'
3+
4+
`options` is a `BuiltInConnectionOptions` object with the following properties:
5+
6+
|Property|Type|Default|Description|
7+
|-|-|-|-|
8+
|`statusCode`|`number`|`200`|<StatusCodeDescription />|
9+
|`headers`|`object`|`{}`|<HeadersDescription />|
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Additional headers to be sent along with the response.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Status code to be sent to the client.<br /><br />Event stream requests can be redirected using HTTP 301 and 307 status codes. Make sure to set `Location` header when using these status codes (301/307) using the `headers` property.<br /><br />A client can be asked to stop reconnecting by send a 204 status code.

0 commit comments

Comments
 (0)