Fix: freezes
This commit is contained in:
		| @@ -59,7 +59,7 @@ func (broker *Broker) ServeHTTP(w http.ResponseWriter, r *http.Request) { | ||||
| 	} | ||||
| 	w.Header().Set("Access-Control-Allow-Origin", origin) | ||||
| 	w.Header().Set("Access-Control-Allow-Credentials", "true") | ||||
| 	messageChan := make(NotifierChan) | ||||
| 	messageChan := make(NotifierChan, 10) // Buffered channel | ||||
| 	broker.newClients <- messageChan | ||||
| 	defer func() { broker.closingClients <- messageChan }() | ||||
| 	ctx := r.Context() | ||||
| @@ -81,7 +81,7 @@ func (broker *Broker) ServeHTTP(w http.ResponseWriter, r *http.Request) { | ||||
| 			w.(http.Flusher).Flush() | ||||
| 		case <-heartbeat.C: | ||||
| 			// Send SSE heartbeat comment | ||||
| 			if _, err := w.Write([]byte(": heartbeat\n\n")); err != nil { | ||||
| 			if _, err := fmt.Fprint(w, ":\n\n"); err != nil { | ||||
| 				return // Client disconnected | ||||
| 			} | ||||
| 			w.(http.Flusher).Flush() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder