mirror of
https://github.com/kataras/iris.git
synced 2026-01-10 05:25:58 +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:
@@ -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.
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/kataras/neffos"
|
||||
"github.com/kataras/neffos/gobwas"
|
||||
"github.com/kataras/neffos/gorilla"
|
||||
"github.com/kataras/neffos/stackexchange/redis"
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -76,4 +77,16 @@ type (
|
||||
// when incoming native message then the `Message.Event` is the `OnNativeMessage`,
|
||||
// native messages are allowed only when an empty namespace("") and its `OnNativeMessage` callback are present.
|
||||
Message = neffos.Message
|
||||
// StackExchange is an optional interface
|
||||
// that can be used to change the way neffos
|
||||
// sends messages to its clients, i.e
|
||||
// communication between multiple neffos servers.
|
||||
//
|
||||
// See `NewRedisStackExchange` to create a new redis StackExchange.
|
||||
StackExchange = neffos.StackExchange
|
||||
// RedisStackExchange is a `neffos.StackExchange` for redis.
|
||||
RedisStackExchange = redis.StackExchange
|
||||
// RedisConfig is used on the `NewRedisStackExchange` package-level function.
|
||||
// Can be used to customize the redis client dialer.
|
||||
RedisConfig = redis.Config
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user