diff --git a/go.mod b/go.mod index 4fa268db..1f8b3c77 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/iris-contrib/go.uuid v2.0.0+incompatible github.com/json-iterator/go v1.1.6 // vendor removed. 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/microcosm-cc/bluemonday v1.0.2 github.com/ryanuber/columnize v2.1.0+incompatible diff --git a/websocket/websocket.go b/websocket/websocket.go index 7be42b99..e1389d6a 100644 --- a/websocket/websocket.go +++ b/websocket/websocket.go @@ -6,6 +6,7 @@ import ( "github.com/kataras/neffos" "github.com/kataras/neffos/gobwas" "github.com/kataras/neffos/gorilla" + "github.com/kataras/neffos/stackexchange/nats" "github.com/kataras/neffos/stackexchange/redis" ) @@ -37,9 +38,18 @@ 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 + // 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. // Should be used on `Dial` to create a new client/client-side connection.