better-sse
Advanced tools
Changelog
0.7.0 - 2022-01-08
Session#push
method to set a custom event ID.push
event that is emitted with the event data, name and ID when the Session#push
method is called.Channel#state
property to have a safe namespace for keeping information attached to the channel.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.Channel#broadcast
method options TypeScript typings to explicitly mandate a boolean
return-type instead of allowing any truthy or falsy value.Channel#broadcast
method event name argument to be optional and default to "message"
if not given.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
.Events
interfaces to SessionEvents
and ChannelEvents
respectively and export them publicly allowing the user to properly type non-inlined event handler callback functions.Changelog
0.6.0 - 2021-10-28
Session#iterate
method that allows processing iterables and sending yielded values to the client as events.Session
and Channel
event listener callback function arguments.Session#state
using an optional generic argument for createSession
and the Session
constructor.Session#stream
event
option to eventName
.Changelog
0.5.0 - 2021-07-17
event-source-polyfill
and eventsource-polyfill
.Session#state
property to have a safe namespace for keeping information attached to the session.Session#lastId
not being read-only.Changelog
0.4.0 - 2021-07-09
Session#isConnected
boolean property.npm
would throw an error mandating it be installed with pnpm
.