a88750d2 by astaxie

support websocket

1 parent da915653
...@@ -258,6 +258,12 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -258,6 +258,12 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
258 Output: beecontext.NewOutput(w), 258 Output: beecontext.NewOutput(w),
259 } 259 }
260 context.Output.Context = context 260 context.Output.Context = context
261
262 if context.Input.IsWebsocket() {
263 context.ResponseWriter = rw
264 context.Output = beecontext.NewOutput(rw)
265 }
266
261 var runrouter *controllerInfo 267 var runrouter *controllerInfo
262 var findrouter bool 268 var findrouter bool
263 269
...@@ -516,7 +522,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -516,7 +522,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
516 panic("gotofunc is exists:" + gotofunc) 522 panic("gotofunc is exists:" + gotofunc)
517 } 523 }
518 } 524 }
519 if !w.started { 525 if !w.started && !context.Input.IsWebsocket() {
520 if AutoRender { 526 if AutoRender {
521 method = vc.MethodByName("Render") 527 method = vc.MethodByName("Render")
522 method.Call(in) 528 method.Call(in)
...@@ -600,7 +606,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -600,7 +606,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
600 method.Call(in) 606 method.Call(in)
601 } 607 }
602 } 608 }
603 if !w.started { 609 if !w.started && !context.Input.IsWebsocket() {
604 if AutoRender { 610 if AutoRender {
605 method = vc.MethodByName("Render") 611 method = vc.MethodByName("Render")
606 method.Call(in) 612 method.Call(in)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!