mirror of
https://github.com/astaxie/beego.git
synced 2024-11-26 07:11:29 +00:00
support websocket
This commit is contained in:
parent
da91565354
commit
a88750d2b3
10
router.go
10
router.go
@ -258,6 +258,12 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
|
|||||||
Output: beecontext.NewOutput(w),
|
Output: beecontext.NewOutput(w),
|
||||||
}
|
}
|
||||||
context.Output.Context = context
|
context.Output.Context = context
|
||||||
|
|
||||||
|
if context.Input.IsWebsocket() {
|
||||||
|
context.ResponseWriter = rw
|
||||||
|
context.Output = beecontext.NewOutput(rw)
|
||||||
|
}
|
||||||
|
|
||||||
var runrouter *controllerInfo
|
var runrouter *controllerInfo
|
||||||
var findrouter bool
|
var findrouter bool
|
||||||
|
|
||||||
@ -516,7 +522,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
|
|||||||
panic("gotofunc is exists:" + gotofunc)
|
panic("gotofunc is exists:" + gotofunc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !w.started {
|
if !w.started && !context.Input.IsWebsocket() {
|
||||||
if AutoRender {
|
if AutoRender {
|
||||||
method = vc.MethodByName("Render")
|
method = vc.MethodByName("Render")
|
||||||
method.Call(in)
|
method.Call(in)
|
||||||
@ -600,7 +606,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
|
|||||||
method.Call(in)
|
method.Call(in)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !w.started {
|
if !w.started && !context.Input.IsWebsocket() {
|
||||||
if AutoRender {
|
if AutoRender {
|
||||||
method = vc.MethodByName("Render")
|
method = vc.MethodByName("Render")
|
||||||
method.Call(in)
|
method.Call(in)
|
||||||
|
Loading…
Reference in New Issue
Block a user