feat: update go to 1.21.3
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user