Fix raw endpoint

pull/12/head v1.1.3
Philipp Heckel 2021-11-02 14:10:56 -04:00
parent b775e6dfce
commit 0e9fa1c4dc
1 changed files with 1 additions and 1 deletions

View File

@ -217,7 +217,7 @@ func (s *Server) handleSubscribeSSE(w http.ResponseWriter, r *http.Request, v *v
func (s *Server) handleSubscribeRaw(w http.ResponseWriter, r *http.Request, v *visitor) error { func (s *Server) handleSubscribeRaw(w http.ResponseWriter, r *http.Request, v *visitor) error {
encoder := func(msg *message) (string, error) { encoder := func(msg *message) (string, error) {
if msg.Event == "" { // only handle default events if msg.Event == messageEvent { // only handle default events
return strings.ReplaceAll(msg.Message, "\n", " ") + "\n", nil return strings.ReplaceAll(msg.Message, "\n", " ") + "\n", nil
} }
return "\n", nil // "keepalive" and "open" events just send an empty line return "\n", nil // "keepalive" and "open" events just send an empty line