Code Monkey home page Code Monkey logo

Comments (6)

mcollina avatar mcollina commented on July 20, 2024

Just use cleansession: true on the the client, that will do.

What code are you using to achieve this? It should work even if it was not intended to be used that way.

from aedes.

mohkar avatar mohkar commented on July 20, 2024

Yes, I am aware of that, but 'cleansession : true' will not hold messages if the client ungracefully disconnects which is something I would not want.
My main concern was, client object is not containing subscriptions in 'subscriptions' field of client on 'clientDisconnect' event.

from aedes.

mcollina avatar mcollina commented on July 20, 2024

Those would already be gone, as with the 'clientDisconnect' event the client has no live subscriptions (that is used for live subscriptions). At the moment, that fied is not part of the public API and it is used internally.

I am fine in exposing this, but it would require a bit of work around doc and testing. The idea should be to have that flushed if the client is clean, but to maintain the state if the client is not clean.

BTW, to achieve what you want, it might be simpler to hook into the persistence and delete them from there directly.

If you want to send a PR, I will be happy to review.

from aedes.

mohkar avatar mohkar commented on July 20, 2024

Hi mcollina,
As you mentioned, I tried deleting subscriptions from redis manually. I did following:
On unsubscribing I deleted client key that is - 'client:sub:{client}' and
removed client entry from subscribed channels - 'sub:client:{subscription}'
However, the aedes is somehow still holding subscriptions and fetching me all the retained messages.

Could you please suggest me how to remove subscriptions completely from aedes.

from aedes.

mcollina avatar mcollina commented on July 20, 2024

You must use the persistence api: https://github.com/mcollina/aedes-persistence
In particular, you need to use: https://github.com/mcollina/aedes-persistence#instancecleansubscriptionsclient-callbackerr-client

(all persistences implement the same API).

from aedes.

mohkar avatar mohkar commented on July 20, 2024

I tried using instancecleansubscription() method and I was able to completely remove clients subscriptions.
Thanks.

from aedes.

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.