-
Notifications
You must be signed in to change notification settings - Fork 270
Closed
Milestone
Description
Currently NewSSEHandler does not have support to pass Options, and adding support later will be a breaking change.
For the actual options to be provided, we can start with #170 and address TODO mentioned in /mcp/sse.go file
This will also do the ground work for any new options we intend to add later. And that time, it won't be a breaking change!!
I am thinking of using same code symanctis we are following for StreamableHTTPHandler.
type SSEOptions struct {
// Logger specifies the logger to use.
// If nil, do not log.
Logger *slog.Logger
}
type SSEHandler struct {
// existing fields
opts SSEOptions
}
And signature change would be like below. Which is same code standard as we do for StreamableHTTPHandler
func NewSSEHandler(getServer func(request *http.Request) *Server, opts *SSEOptions) *SSEHandler {
s := &SSEHandler{
getServer: getServer,
sessions: make(map[string]*SSEServerTransport),
}
if opts != nil {
s.opts = *opts
}
if s.opts.Logger == nil { // ensure we have a logger
s.opts.Logger = ensureLogger(nil)
}
s.logger = s.opts.Logger
return s
}
Metadata
Metadata
Assignees
Labels
No labels