Socket
Socket
Sign inDemoInstall

better-sse

Package Overview
Dependencies
0
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install
2Next

0.12.0

Diff

Changelog

Source

0.12.0 - 2024-05-10

Added

mwid
published 0.11.0 •

Changelog

Source

0.11.0 - 2024-02-08

Added

  • Added the SseError custom error object that wraps all thrown errors.

Changed

  • Update the Session#push method to throw if the session is not connected.

Fixed

  • Fixed session not detecting a response stream disconnect.
mwid
published 0.10.0 •

Changelog

Source

0.10.0 - 2023-09-28

Added

  • Added the Session#batch method that can be used to batch multiple events into a single transmission over the wire.
  • Added the EventBuffer class that can be used to write raw spec-compliant SSE fields into a text buffer that can be sent directly over the wire.

Deprecated

  • Deprecate the Session .event, .data, .id, .retry, .comment, .dispatch and .flush methods in favour of using event buffers instead.
mwid
published 0.9.0 •

Changelog

Source

0.9.0 - 2023-08-14

Added

  • Added the ability to type the state property of sessions registered with a Channel via an optional second generic argument to the Channel constructor.
  • Added the DefaultChannelState interface that may be used via module augmentation to alter the default channel state type for all channels.

Changed

mwid
published 0.8.0 •

Changelog

Source

0.8.0 - 2022-06-02

Added

  • Added an internal data buffer to Session that buffers written data internally until it is flushed to the client using the new Session#flush method.
  • Added the Pragma, X-Accel-Buffering headers and add additional values to the Cache-Control default header to further disable all forms of caching.
  • Added support for supplying the Node HTTP/2 compatibility API Http2ServerRequest and Http2ServerResponse objects to the Session constructor req and res parameters, respectively.

Changed

  • Update the Session#event, Session#data, Session#id, Session#retry and Session#comment methods to write to the internal data buffer instead of sending the field data over the wire immediately.
  • Update the Session#dispatch method to only write a newline (and to the internal data buffer) and not flush the written data to the client.
  • Update the Channel#broadcast method to generate its own custom event ID and thus add it as an additional argument to its broadcast event callback function.
  • Update the Channel#register and Channel#deregister to not do anything if the channel is already registered or deregistered, respectively.
  • Update the Session constructor options header field to overwrite conflicting default headers instead of being ignored.
  • Update auto-generated event IDs to be guaranteed to be a cryptographically unique string instead of a pseudorandomly generated string of eight characters.

Fixed

  • Fixed the Channel session-disconnected being fired after instead of before the session is deregistered.

Removed

  • Removed the ability to pass null to Session#id. Give no arguments at all instead.
mwid
published 0.7.1 •

Changelog

Source

0.7.1 - 2022-01-11

Fixed

  • Removed type-declarations generated from unit testing files.
mwid
published 0.7.0 •

Changelog

Source

0.7.0 - 2022-01-08

Added

  • Added the ability to the Session#push method to set a custom event ID.
  • Added a new Session push event that is emitted with the event data, name and ID when the Session#push method is called.
  • Added the Channel#state property to have a safe namespace for keeping information attached to the channel.

Changed

  • Update the arguments for the Session#push and Channel#broadcast methods and their corresponding emitted event callbacks to always have the event data first and event name as an optional argument second.
  • Update the Channel#broadcast method options TypeScript typings to explicitly mandate a boolean return-type instead of allowing any truthy or falsy value.
  • Update the Channel#broadcast method event name argument to be optional and default to "message" if not given.
  • Update the Session#state generic argument to default to a new SessionState interface that can be augmented via declaration merging to override the session state type for all session objects without explicitly providing a generic argument to each reference to Session.
  • Rename the Session and Channel Events interfaces to SessionEvents and ChannelEvents respectively and export them publicly allowing the user to properly type non-inlined event handler callback functions.
mwid
published 0.6.0 •

Changelog

Source

0.6.0 - 2021-10-28

Added

  • Added the Session#iterate method that allows processing iterables and sending yielded values to the client as events.
  • Added types for Session and Channel event listener callback function arguments.
  • Added the ability to type Session#state using an optional generic argument for createSession and the Session constructor.

Changed

mwid
published 0.5.0 •

Changelog

Source

0.5.0 - 2021-07-17

Added

Fixed

mwid
published 0.4.0 •

Changelog

Source

0.4.0 - 2021-07-09

Added

Fixed

  • Fixed an issue where installing the package using npm would throw an error mandating it be installed with pnpm.
2Next
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc