Code Monkey home page Code Monkey logo

Comments (5)

FZambia avatar FZambia commented on May 17, 2024

Empty string already used as a sign to make operation with all things - in unsubscribe command empty channel unsubscribes user from all channels. So I think empty string should be ok to keep support the same semantics. At moment Centrifugo just closes connections when processes disconnect API cmd, now we need to send disconnect message to clients. As you know there is reconnect flag in it. This reconnect flag will be optionally set in web interface and by default will be true I suppose - so even if disconnect button was pressed accidentally from web interface - users will reconnect.

from centrifugo.

FZambia avatar FZambia commented on May 17, 2024

Can make this empty string const at moment and then move to configuration if needed. The problem I came across while thinking how to make this is that disconnecting all users is operation that takes a time - so some of users can disconnect and even reconnect during this operation (especially if application has many users). So I can't decide - is this ok or not? What can we do with this case and should we? Just locking client hub won't help as new connections will be just queued for a while. Setting extra flags on the time of operation looks like overengineering. @banks whats your thoughts?

from centrifugo.

banks avatar banks commented on May 17, 2024

Yeah so this is not as simple as I thought - I assumed disconnect already sent message back to client.

So let me re-state what I actually want rather than just suggest we change this existing feature.

What would be useful in some cases would be te ability to put a whole centrifguo cluster into "load shedding" mode where they:

  • deny incoming requests with a permanent error
  • close all existing connections with a reconnect: false message

The motivation is that in real-world we see clients still connected weeks after stopping a load test of centrifugo. For example, I ran a load test which had about 50k users connected and I still see about 100 users connected now - over a week since I stopped including JS on the page that makes the connections! For first 24 hours after load test it's in the thousands.

One way to achieve this would be to have some application property that is checked on each request (like config properties are) and then just make and admin API to toggle it with enough warnings about how destructive it is.

Honestly not sure if it's worth it though if it's relatively hard to do. There are other ways to acheive same thing - alter HMAC secret and restart for a while so that all the reconnects are failed permenantly due to bad auth for example. (not tried that but I assume it would work).

from centrifugo.

FZambia avatar FZambia commented on May 17, 2024

Trick with altering secret should help.

There is already shutdown method called when SIGINT received. And shutdown property in application. Maybe try to make shutdown as button in web interface? At moment on shutdown connections just closed - so will reconnect, maybe shutdown with optional reconnect flag? But anyway there may be some users that have not processed disconnect message and will try to reconnect.

from centrifugo.

FZambia avatar FZambia commented on May 17, 2024

Closing with won't do resolution, because as time goes there is still no obvious solution. Hopefully this is a rare requirement and changing secret can be a reasonable workaround to solve this case.

from centrifugo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.