better-sse
Advanced tools
Changelog
0.14.0 - 2024-10-18
createSession
and createChannel
being set to unknown
instead of DefaultSessionState
and DefaultChannelState
, respectively.Changelog
0.13.0 - 2024-08-23
state
property in the Session
and Channel
constructor options
objects.State
generics passed to Session
and Channel
extend from Record<string, unknown>
.Changelog
0.11.0 - 2024-02-08
SseError
custom error object that wraps all thrown errors.Session#push
method to throw if the session is not connected.Changelog
0.10.0 - 2023-09-28
Session#batch
method that can be used to batch multiple events into a single transmission over the wire.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..event
, .data
, .id
, .retry
, .comment
, .dispatch
and .flush
methods in favour of using event buffers instead.Changelog
0.9.0 - 2023-08-14
state
property of sessions registered with a Channel via an optional second generic argument to the Channel
constructor.DefaultChannelState
interface that may be used via module augmentation to alter the default channel state type for all channels.SessionState
interface to be named DefaultSessionState
.Changelog
0.8.0 - 2022-06-02
Session#flush
method.Pragma
, X-Accel-Buffering
headers and add additional values to the Cache-Control
default header to further disable all forms of caching.Http2ServerRequest
and Http2ServerResponse
objects to the Session
constructor req
and res
parameters, respectively.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.Session#dispatch
method to only write a newline (and to the internal data buffer) and not flush the written data to the client.Channel#broadcast
method to generate its own custom event ID and thus add it as an additional argument to its broadcast
event callback function.Channel#register
and Channel#deregister
to not do anything if the channel is already registered or deregistered, respectively.Session
constructor options header
field to overwrite conflicting default headers instead of being ignored.session-disconnected
being fired after instead of before the session is deregistered.null
to Session#id
. Give no arguments at all instead.