sync kataras/iris/websocket with kataras/neffos - added support for nats scaling and Server.Ask method

Former-commit-id: 3a3f00410e113817c4e609feaad70f76c0b09b57
This commit is contained in:
Gerasimos (Makis) Maropoulos 2019-07-14 20:22:59 +03:00
parent c2c748067c
commit 86a18ff545
2 changed files with 11 additions and 1 deletions

2
go.mod
View File

@ -15,7 +15,7 @@ require (
github.com/iris-contrib/go.uuid v2.0.0+incompatible github.com/iris-contrib/go.uuid v2.0.0+incompatible
github.com/json-iterator/go v1.1.6 // vendor removed. github.com/json-iterator/go v1.1.6 // vendor removed.
github.com/kataras/golog v0.0.0-20180321173939-03be10146386 github.com/kataras/golog v0.0.0-20180321173939-03be10146386
github.com/kataras/neffos v0.0.6 github.com/kataras/neffos v0.0.7
github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d // indirect github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d // indirect
github.com/microcosm-cc/bluemonday v1.0.2 github.com/microcosm-cc/bluemonday v1.0.2
github.com/ryanuber/columnize v2.1.0+incompatible github.com/ryanuber/columnize v2.1.0+incompatible

View File

@ -6,6 +6,7 @@ import (
"github.com/kataras/neffos" "github.com/kataras/neffos"
"github.com/kataras/neffos/gobwas" "github.com/kataras/neffos/gobwas"
"github.com/kataras/neffos/gorilla" "github.com/kataras/neffos/gorilla"
"github.com/kataras/neffos/stackexchange/nats"
"github.com/kataras/neffos/stackexchange/redis" "github.com/kataras/neffos/stackexchange/redis"
) )
@ -37,9 +38,18 @@ var (
DefaultIDGenerator = func(ctx context.Context) string { DefaultIDGenerator = func(ctx context.Context) string {
return neffos.DefaultIDGenerator(ctx.ResponseWriter(), ctx.Request()) return neffos.DefaultIDGenerator(ctx.ResponseWriter(), ctx.Request())
} }
// NewRedisStackExchange returns a new redis StackExchange. // NewRedisStackExchange returns a new redis StackExchange.
// The "channel" input argument is the channel prefix for publish and subscribe. // The "channel" input argument is the channel prefix for publish and subscribe.
NewRedisStackExchange = redis.NewStackExchange NewRedisStackExchange = redis.NewStackExchange
// NewNatsStackExchange returns a new nats StackExchange.
// The "url" input argument is the connection string of your nats server.
// The second variadic input argument can be used to use custom `nats.Option`s
// such as authentication and more nats servers addresses.
NewNatsStackExchange = nats.NewStackExchange
// WithNatsOptions can be used as the second input argument of `NewNatsStackExchange`
// to declare a struct-based configuration for the nats server(s).
WithNatsOptions = nats.With
// GorillaDialer is a `Dialer` type for the gorilla/websocket subprotocol implementation. // GorillaDialer is a `Dialer` type for the gorilla/websocket subprotocol implementation.
// Should be used on `Dial` to create a new client/client-side connection. // Should be used on `Dial` to create a new client/client-side connection.