feat: update go to 1.21.3

This commit is contained in:
efim
2023-11-06 03:52:28 +00:00
parent 4dbbfcd6f2
commit aa048efbd3
5 changed files with 64 additions and 13 deletions

View File

@@ -32,6 +32,8 @@ func registerPageRoutes(
func streamingBsRoute() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
r.ParseForm()
queryParam := r.FormValue("mobile")
w.Header().Set("Cache-Control", "no-cache")
w.Header().Set("Connection", "keep-alive")
w.Header().Set("Content-Type", "text/event-stream")
@@ -43,10 +45,10 @@ func streamingBsRoute() http.HandlerFunc {
return
default:
log.Printf("another step in streaming bs")
data := "data: <div>hello with data %d! waited %d</div> \n\n"
data := "data: <div>hello with data %d! waited %d. mobile is %s</div> \n\n"
startTime = time.Now().Nanosecond()
diff := endTime - startTime
fmt.Fprintf(w, data, rand.Intn(100), diff)
fmt.Fprintf(w, data, rand.Intn(100), diff, queryParam)
w.(http.Flusher).Flush()
time.Sleep(3 * time.Second)
endTime = time.Now().Nanosecond()