v0.11.0 #52
tmaxmax
announced in
Announcements
v0.11.0
#52
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
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 ecosystemChanged
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 work with labstack's echo web framework has problem #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.Joe
causing a channel double close in an edge case scenario (see IsServer.Publish
threadsafe? #50, see code for details)New Contributors
slog
and adding it to the library!This discussion was created from the release v0.11.0.
Beta Was this translation helpful? Give feedback.
All reactions