v0.11.0
Pre-release
Pre-release
The sse.Server
logging and session handling were revamped to have more familiar, more flexible and less error prone interfaces for users. Some bugs were also fixed.
Removed
Logger
andLogLevel
enum have been removed.Server.Logger
has transitioned to the standardslog
library for better compatibility with the ecosystem
Changed
Server.Logger
is now of typefunc(r *http.Request) *slog.Logger
instead ofsse.Logger
– it is possible to customize the logger on a per-request basis, by for example retrieving it from the context.Server.OnSession
signature changed fromfunc(s *Session) (Subscription, bool)
tofunc(w http.ResponseWriter, r *http.Request) (topics []string, accepted bool)
– its initial role was to essentially just provide the topics, so the need to fiddle withSession
andSubscription
was redundant anywayJoe.Subscribe
now always returnsErrProviderClosed
when aJoe
instance is closed while subscriptions are active. Previously it would return it only ifJoe
was already shut down before subscribing.Joe
will print a stack trace forReplayer
panics.
Fixed
sse.Session
doesn't write the header explicitly anymore. This would cause ahttp: superfluous response.WriteHeader call
warning being logged whensse.Server.OnSession
writes a response code itself when accepting a session. The change was initially introduced to remove the warning for users of certain external libraries (see #41) but this is the issue of the external library, not ofgo-sse
. If you encounter this warning when using an external library, write the response code yourself in the HTTP handler before subscribing thesse.Session
, as described in the linked discussion.- An insidious synchronization issue in
Joe
causing a channel double close in an edge case scenario (see #50, see code for details)
New Contributors
- @brnsampson in #48, thank you for bringing up
slog
and adding it to the library! - @NathanBaulch in #45 and @ZackarySantana in #46. I normally don't merge typo fixes from others but these deserved it. Thank you!