You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use the "github.com/alexandrevicenzi/go-sse" package to implement SSE functionality. And I want to integrate this with mvc.application. I'm not very familiar with iris.fromstd at the moment. Don't know what to do to make them run properly, please give me a little help. Thanks。
The 3rd-party library you use for SSE, provides an http.Handler which works as an event broker on by itself (clients are registered to a channel group in order to receive server-sent messages), so the only thing you have to do is to send any events using its own "SendMessage" method in a different go routine. There is no reason to register that SSE Handler inside a controller: app.Get("/events/{channel}", iris.FromStd(s)), the iris.FromStd converts any http.Handler/http.HandlerFunc or http.Handler with next http.Handler to an iris.Handler. See https://github.com/kataras/iris/blob/main/_examples/response-writer/sse-third-party-2/main.go
@kataras thanks for your reply. how to close the connection properly, if I write based on the example of iris-contrib/examples/response-write/sse. I‘m using mvc router.
I want to use the "github.com/alexandrevicenzi/go-sse" package to implement SSE functionality. And I want to integrate this with mvc.application. I'm not very familiar with iris.fromstd at the moment. Don't know what to do to make them run properly, please give me a little help. Thanks。
The text was updated successfully, but these errors were encountered: