react-native-nitro-sse 3.2.0-beta.1 → 3.2.0

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.
@@ -32,7 +32,9 @@ def reactNativeArchitectures() {
32
32
  }
33
33
 
34
34
  apply plugin: "com.android.library"
35
- apply plugin: "kotlin-android"
35
+ if (project.extensions.findByName('kotlin') == null) {
36
+ apply plugin: "kotlin-android"
37
+ }
36
38
  apply from: '../nitrogen/generated/android/nitrosse+autolinking.gradle'
37
39
 
38
40
  apply plugin: "com.facebook.react"
@@ -799,13 +799,14 @@ class NitroSse @DoNotStrip constructor() : HybridNitroSseSpec(), SseConnectionDe
799
799
  updateState(SseState.STALE)
800
800
  }
801
801
 
802
+ val reportedStatusCode = if (statusCode >= 400 || statusCode == 204) statusCode.toDouble() else null
802
803
  val defaultErrorMsg = when {
803
804
  statusCode >= 500 && !errorBody.isNullOrBlank() -> "Server Error ($statusCode): ${errorBody.trim()}"
804
- else -> t?.message ?: "Link lost ($statusCode)"
805
+ else -> t?.message ?: if (reportedStatusCode != null) "Link lost (${reportedStatusCode.toInt()})" else "Link lost"
805
806
  }
806
807
 
807
808
  // Teardown and reconnect on stream or socket failure.
808
- eventBuffer.push(SseEvent(SseEventType.ERROR, null, null, null, null, defaultErrorMsg, if (statusCode != -1) statusCode.toDouble() else null, null, null))
809
+ eventBuffer.push(SseEvent(SseEventType.ERROR, null, null, null, null, defaultErrorMsg, reportedStatusCode, null, null))
809
810
  scheduleReconnect(true, connectionAttemptVersion.get())
810
811
  }
811
812
  }
@@ -535,7 +535,13 @@ export class FetchSseDriver {
535
535
  if (!this._isRunning || attemptVersion !== this._connectionAttemptVersion) return;
536
536
  const isAborted = abortController.signal.aborted;
537
537
  if (!isAborted) {
538
- this._recordError(readErr instanceof Error ? readErr.message : 'Read error', undefined);
538
+ const errorMsg = readErr instanceof Error ? readErr.message : 'Read error';
539
+ this._disconnectReason = 'network_error';
540
+ this._recordError(errorMsg, undefined);
541
+ this._pushEvent({
542
+ type: 'error',
543
+ message: errorMsg
544
+ });
539
545
  this._scheduleReconnect(true, undefined, attemptVersion);
540
546
  return;
541
547
  }
@@ -646,6 +652,12 @@ export class FetchSseDriver {
646
652
  if (this._isRunning && attemptVersion === this._connectionAttemptVersion) {
647
653
  this._disconnectReason = 'timeout';
648
654
  this._updateState('stale');
655
+ const errorMsg = 'Read timeout';
656
+ this._recordError(errorMsg, undefined);
657
+ this._pushEvent({
658
+ type: 'error',
659
+ message: errorMsg
660
+ });
649
661
  this._cleanupTransport();
650
662
  this._scheduleReconnect(true, undefined, attemptVersion);
651
663
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nitro-sse",
3
- "version": "3.2.0-beta.1",
3
+ "version": "3.2.0",
4
4
  "description": "High-performance Server-Sent Events (SSE) for React Native, powered by Nitro Modules.",
5
5
  "main": "./lib/module/index.js",
6
6
  "react-native": "./lib/module/index.native.js",
@@ -88,12 +88,12 @@
88
88
  "@eslint/compat": "^1.3.2",
89
89
  "@eslint/eslintrc": "^3.3.1",
90
90
  "@eslint/js": "^9.35.0",
91
- "@react-native/babel-preset": "0.85.3",
92
- "@react-native/eslint-config": "0.85.3",
93
- "@react-native/jest-preset": "0.85.3",
91
+ "@react-native/babel-preset": "0.88.0",
92
+ "@react-native/eslint-config": "0.88.0",
93
+ "@react-native/jest-preset": "0.88.0",
94
94
  "@release-it/conventional-changelog": "^10.0.1",
95
95
  "@types/jest": "^29.5.14",
96
- "@types/react": "^19.2.0",
96
+ "@types/react": "^19.3.0",
97
97
  "commitlint": "^19.8.1",
98
98
  "del-cli": "^6.0.0",
99
99
  "eslint": "^9.35.0",
@@ -103,8 +103,8 @@
103
103
  "lefthook": "^2.0.3",
104
104
  "nitrogen": "0.37.1",
105
105
  "prettier": "^2.8.8",
106
- "react": "19.2.3",
107
- "react-native": "0.85.3",
106
+ "react": "19.3.1",
107
+ "react-native": "0.88.0",
108
108
  "react-native-builder-bob": "^0.40.17",
109
109
  "react-native-nitro-modules": "0.37.1",
110
110
  "release-it": "^19.0.4",