1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 02:17:05 +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

@@ -4,11 +4,17 @@ import (
"github.com/kataras/iris/context"
"github.com/kataras/neffos"
"github.com/kataras/neffos/gobwas"
"github.com/kataras/neffos/gorilla"
"github.com/kataras/neffos/stackexchange/redis"
)
var (
// EnableDebug enables debug mode for websocket module,
// for MVC this is done automatically
// when the app's logger level is set to "debug".
EnableDebug = neffos.EnableDebug
// GorillaUpgrader is an upgrader type for the gorilla/websocket subprotocol implementation.
// Should be used on `New` to construct the websocket server.
GorillaUpgrader = gorilla.Upgrader
@@ -32,6 +38,9 @@ var (
DefaultIDGenerator = func(ctx context.Context) string {
return neffos.DefaultIDGenerator(ctx.ResponseWriter(), ctx.Request())
}
// NewRedisStackExchange returns a new redis StackExchange.
// The "channel" input argument is the channel prefix for publish and subscribe.
NewRedisStackExchange = redis.NewStackExchange
// GorillaDialer is a `Dialer` type for the gorilla/websocket subprotocol implementation.
// Should be used on `Dial` to create a new client/client-side connection.