diff --git a/transport_jsonppolling.go b/transport_jsonppolling.go index b86385e..850246d 100644 --- a/transport_jsonppolling.go +++ b/transport_jsonppolling.go @@ -4,7 +4,6 @@ import ( "http" "os" "io" - "net" "strconv" "json" "fmt" @@ -58,8 +57,8 @@ func (s *jsonpPollingSocket) accept(w http.ResponseWriter, req *http.Request, pr rwc, _, err := w.(http.Hijacker).Hijack() if err == nil { - rwc.(*net.TCPConn).SetReadTimeout(s.t.rtimeout) - rwc.(*net.TCPConn).SetWriteTimeout(s.t.wtimeout) + rwc.SetReadTimeout(s.t.rtimeout) + rwc.SetWriteTimeout(s.t.wtimeout) s.rwc = rwc s.connected = true s.index = 0 diff --git a/transport_xhrpolling.go b/transport_xhrpolling.go index 6d0b130..01044f0 100644 --- a/transport_xhrpolling.go +++ b/transport_xhrpolling.go @@ -5,7 +5,6 @@ import ( "bytes" "os" "io" - "net" "fmt" ) @@ -56,10 +55,13 @@ func (s *xhrPollingSocket) accept(w http.ResponseWriter, req *http.Request, proc } s.req = req - s.rwc, _, err = w.(http.Hijacker).Hijack() + rwc, _, err := w.(http.Hijacker).Hijack() + if err == nil { - s.rwc.(*net.TCPConn).SetReadTimeout(s.t.rtimeout) - s.rwc.(*net.TCPConn).SetWriteTimeout(s.t.wtimeout) + rwc.SetReadTimeout(s.t.rtimeout) + rwc.SetWriteTimeout(s.t.wtimeout) + + s.rwc = rwc.(io.ReadWriteCloser) s.connected = true proceed() }