....
func testFuncHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "===data test_server_msg===")
}
....
func testFuncHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "===data test_server_msg===")
hj, ok := w.(http.Hijacker) //Проверка протокола на возможность Hijack
if !ok {
http.Error(w, "webserver doesn't support hijacking", http.StatusInternalServerError)
return
}
conn, _, err := hj.Hijack() //Вот здесь захват контроля
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
conn.Close()
}