v0.11.0
Better SSE Version 0.11.0
npm install better-sse@latestyarn add better-sse@latestpnpm add better-sse@latestThis release adds better error handling and minor fixes related to sessions detecting a disconnect (thanks to @agix.)
Changes
Session disconnect detection improvements (#57)
Sessions will now also detect a disconnect if the outgoing HTTP response stream closes, rather than just the incoming request stream.
Additionally, the Session#push method (and subsequently other methods that call it such as the Session stream, iterate and the Channel#broadcast methods) will now throw when being called on a session that is not active.
Custom errors
All SSE-related errors thrown from within Better SSE will now be wrapped with the newly exported SseError custom error class.
This enables you to differentiate generic errors from SSE-related errors using instanceof. For example:
try {
session.push("some data");
} catch (error) {
if (error instanceof SseError) {
console.error(`Oops! ${error.message}`);
} else {
...
}
}Full Changelog
Added
- Added the
SseErrorcustom error object that wraps all thrown errors.
Changed
- Update the
Session#pushmethod to throw if the session is not connected.
Fixed
- Fixed session not detecting a response stream disconnect.