1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-08 20:41:57 +00:00

add the new neffos StackExchange feature to the type aliases and shortcuts of the websocket subpackage and auto-enable debug mode on websocket MVC application when iris logger's level is set to debug

Former-commit-id: 4d8cb79d01a4172fc1ed7a9b626da0228d902b3c
This commit is contained in:
Gerasimos (Makis) Maropoulos
2019-07-11 12:59:11 +03:00
parent 82d645e3cb
commit 33dfb42d73
10 changed files with 83 additions and 57 deletions

View File

@@ -64,6 +64,7 @@ func New(party router.Party) *Application {
if HeroDependencies {
values = hero.Dependencies().Clone()
}
return newApp(party, values)
}
@@ -195,6 +196,10 @@ var _ websocket.ConnHandler = (*Application)(nil)
// It returns a collection of namespace and events that
// were registered through `HandleWebsocket` controllers.
func (app *Application) GetNamespaces() websocket.Namespaces {
if golog.Default.Level == golog.DebugLevel {
websocket.EnableDebug(golog.Default)
}
makeInjector := func(injector *di.StructInjector) websocket.StructInjector {
return func(_ reflect.Type, nsConn *websocket.NSConn) reflect.Value {
v := injector.Acquire()
@@ -212,7 +217,6 @@ func (app *Application) GetNamespaces() websocket.Namespaces {
wsInjector := makeInjector(c.injector)
s := websocket.NewStruct(c.Value).SetInjector(wsInjector)
websocketControllers = append(websocketControllers, s)
}
}