-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Streaming unsupported #130
Comments
It seems like for some reason the http.ResponseWriter has no http.Flusher? |
As per the documentation:
I am using a CORS wrapper: corsHandler := cors.New(cors.Options{
AllowedOrigins: []string{"http://localhost:3000", "http://127.0.0.1:3000"},
AllowedMethods: []string{http.MethodGet, http.MethodPost, http.MethodDelete},
AllowCredentials: true,
}).Handler(server.Router)
Logger.Fatal(http.ListenAndServe(":1337", server.SessionManager.LoadAndSave(corsHandler))) Most likely this is the issue. |
I need CORS otherwise the EventSource request will be blocked by CORS. |
I'm still getting "Streaming unsupported!" even if I add the CORS header manually and remove the CORS library. |
Maybe the session manager doesn't support it? |
Hey @mooijtech , Please could you try and run this simpler example and see if it behaves correctly? I am unable to reproduce the issue you are seeing. package main
import (
"time"
"net/http"
"github.com/r3labs/sse/v2"
)
func main() {
s := sse.New()
s.CreateStream("test")
go func() {
for {
s.Publish("test", &sse.Event{Data: []byte("hello")})
time.Sleep(time.Second)
}
}()
s.Headers = map[string]string{
"Access-Control-Allow-Origin": "*",
}
// Create a new Mux and set the handler
mux := http.NewServeMux()
mux.HandleFunc("/", s.ServeHTTP)
http.ListenAndServe(":8080", mux)
} |
Hello, Thanks for your response. I will open an issue there. |
Hello,
I am trying to setup SSE for a progress bar but I am getting "Streaming unsupported!" in FireFox.
Client:
Server:
The text was updated successfully, but these errors were encountered: