i am using go 1.4.2 and the implementation doesn't seem to have CloseNotifier
as i want to use it in a long polling handler with something like:
func Pollhandler(w http.ResponseWriter, r *http.Request) {
notify := w.(CloseNotifier).CloseNotify()
<-notify //should block until the http connection is closed
}
is the CloseNotifier not implemented for the http ResponseWriter
? if so how can i get around this? or is there any implementation for http ResponseWriter
that implements the CloseNotifier
interface?
http.CloseNotifier
has been there since Go 1.1. Your code doesn't work because you forgot the package part:
notify := w.(http.CloseNotifier).CloseNotify()