-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE REQUEST] adapters support for scalability #3
Comments
Hello @syklevin, neffos already allow users to add their own implementations or wrap an existing one, see the Tell me if that helped, and if not, please write down how you imagine it to use/API, with go code. I thank YOU for your support! |
thanks for the docs, let me read it deeply and try to make a custom Upgrader. |
@syklevin Sorry, the Upgraders and Dialers is not the place for that type of implementation (it can be done through it but it requires more boilerplate code at this case). I have to ask you, signalr can keep messages that's why redis is important there on production and to scale out but neffos does not percist messages so there is no data stored in the server-side except the websocket connections and its information like connected namespaces and joined rooms. At the other side, for scaling it may be useful but are we sure is for the best or real need to adapt redis pub sub on neffos as a built-in feature? Because I think you can handle it outside of neffos, inside your app, and just call the specific events based on the connection ID from a redis SUBSCRIBE and do redis PUBLISH from inside neffos events. Give me some days for R&D and thinking more about the necessity of implement that as built-in package (which will require an external dependency of the redigo library, which is heavy and I really want to keep neffos clean of extra external dependencies) or as a different optional package/repository. |
Hey @syklevin , It didn't took long, 1 day asleep and it's ready. It works with redis clusters too (signalR does not). I didn't use the redigo library because it's heavy enough and I wanted other code style for performance boost and subscribe whenever is required, so I used the radix one as I did with iris redis session database for v11.2 - it is not popular like redigo or redis-go but as far as I made my research, he seems a passionate guy and good coder* Example: https://github.com/kataras/neffos/tree/master/_examples/scale-out Redisimport "github.com/kataras/neffos/stackexchange/redis" // [server := neffos.New...]
exc, err := redis.NewStackExchange(redis.Config{}, "MyChatApp")
if err != nil {
// [...]
}
server.UseStackExchange(exc) Natsimport "github.com/kataras/neffos/stackexchange/nats" // [server := neffos.New...]
exc, err := nats.NewStackExchange(":4222" /*, [other optional args here...]*/ )
if err != nil {
// [...]
}
server.UseStackExchange(exc) Made with: Please test it out and tell me if I missed something out or if that was exactly what you were looking for, thanks again! |
WOW! That is exactly what i looking for. can't wait to try it out and get back to you. |
Like socketio or signalr, they provide serval adapters such as redis.
Hope neffos could provide the adapter interface. let users could add their own implemention;
And It would be great for builtin support serval great pubsub system like redis and nats
Thanks again for the great library.
The text was updated successfully, but these errors were encountered: