react-native-nitro-sse 3.1.0 → 3.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -4
- package/lib/module/FetchSseDriver.js +845 -0
- package/lib/module/NitroSseClient.js +19 -17
- package/lib/module/SseDriver.js +31 -15
- package/lib/module/SseEventParser.js +238 -0
- package/lib/module/createNitroSse.js +12 -5
- package/lib/module/createNitroSse.native.js +24 -0
- package/lib/module/createNitroSse.web.js +13 -0
- package/lib/module/index.js +2 -1
- package/lib/module/index.native.js +8 -0
- package/lib/module/index.web.js +9 -0
- package/lib/module/useNitroSse.js +1 -1
- package/lib/typescript/src/FetchSseDriver.d.ts +92 -0
- package/lib/typescript/src/NitroSseClient.d.ts +4 -1
- package/lib/typescript/src/SseDriver.d.ts +8 -4
- package/lib/typescript/src/SseEventParser.d.ts +42 -0
- package/lib/typescript/src/createNitroSse.d.ts +2 -2
- package/lib/typescript/src/createNitroSse.native.d.ts +9 -0
- package/lib/typescript/src/createNitroSse.web.d.ts +8 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.native.d.ts +6 -0
- package/lib/typescript/src/index.web.d.ts +7 -0
- package/package.json +12 -1
package/README.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# react-native-nitro-sse
|
|
2
2
|
|
|
3
|
-
Server-Sent Events (SSE) client for React Native built on Nitro Modules (JSI).
|
|
3
|
+
Server-Sent Events (SSE) client for React Native built on Nitro Modules (JSI) with seamless Web support.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- **JSI Execution**: Direct synchronous JS-to-native calls via Nitro Modules.
|
|
9
|
+
- **JSI Execution (Native)**: Direct synchronous JS-to-native calls via Nitro Modules on iOS and Android.
|
|
10
|
+
- **Universal Web Support**: Pure JS driver powered by the Fetch & ReadableStream API for React Native Web and Web browsers.
|
|
10
11
|
- **Reconnection**: Exponential backoff with jitter and HTTP 429 (`Retry-After`) handling.
|
|
11
12
|
- **Event Batching**: Configurable batch interval and buffer size limits.
|
|
12
13
|
- **Lifecycle & Network**: Automatic pause and resume on app state or network transitions.
|
|
@@ -15,6 +16,16 @@ Server-Sent Events (SSE) client for React Native built on Nitro Modules (JSI).
|
|
|
15
16
|
|
|
16
17
|
---
|
|
17
18
|
|
|
19
|
+
## Platform Support
|
|
20
|
+
|
|
21
|
+
| Platform | Implementation |
|
|
22
|
+
| :------- | :------------- |
|
|
23
|
+
| **iOS** | Nitro Modules (JSI) + URLSession |
|
|
24
|
+
| **Android** | Nitro Modules (JSI) + OkHttp |
|
|
25
|
+
| **Web** | Pure JS `FetchSseDriver` (Fetch Streams) |
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
18
29
|
## Installation
|
|
19
30
|
|
|
20
31
|
```sh
|
|
@@ -23,7 +34,7 @@ npm install react-native-nitro-sse react-native-nitro-modules
|
|
|
23
34
|
yarn add react-native-nitro-sse react-native-nitro-modules
|
|
24
35
|
```
|
|
25
36
|
|
|
26
|
-
> **Note**: `react-native-nitro-modules` is a peer dependency.
|
|
37
|
+
> **Note**: `react-native-nitro-modules` is a peer dependency required for iOS and Android native compilation. On Web, the library uses the pure JS Fetch driver and does not invoke native binaries.
|
|
27
38
|
|
|
28
39
|
<details>
|
|
29
40
|
<summary><b>Compatibility Matrix</b></summary>
|
|
@@ -238,7 +249,7 @@ try {
|
|
|
238
249
|
|
|
239
250
|
| Error Class | Error Code | Description |
|
|
240
251
|
| :---------------------------- | :------------------------------------- | :-------------------------------------------------------------------- |
|
|
241
|
-
| `NitroSseModuleNotFoundError` | `NATIVE_MODULE_NOT_FOUND` | Native Nitro module binary is missing.
|
|
252
|
+
| `NitroSseModuleNotFoundError` | `NATIVE_MODULE_NOT_FOUND` | Native Nitro module binary is missing (iOS/Android only). |
|
|
242
253
|
| `NitroSseValidationError` | `INVALID_CONFIG` \| `INVALID_ARGUMENT` | Invalid argument or configuration parameter. |
|
|
243
254
|
| `NitroSseStateError` | `INVALID_STATE` | Method invoked in an invalid state (e.g. `start()` before `setup()`). |
|
|
244
255
|
| `NitroSseDisposedError` | `CLIENT_DISPOSED` | Method invoked on an already disposed client instance. |
|