-
-
Save najamsk/7ec97d0a155653eed74c9fdcbf58a3a9 to your computer and use it in GitHub Desktop.
gorilla streaming response
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func StreamHandler(w http.ResponseWriter, r *http.Request) { | |
log.Println("string handler invoked") | |
for i := 0; i < 15000; i++ { | |
w.Write([]byte("Gorilla! \n")) | |
w.(http.Flusher).Flush() | |
time.Sleep(1 * time.Second) | |
// time.Sleep(1 * time.Second) | |
} | |
fmt.Println("done") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment