Skip to content
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

How to check if a client is disconnected from the broker #294

Open
irfanazam1 opened this issue Oct 4, 2023 · 2 comments
Open

How to check if a client is disconnected from the broker #294

irfanazam1 opened this issue Oct 4, 2023 · 2 comments

Comments

@irfanazam1
Copy link

I am using the HTTP auth plugin for authentication, that calls into a REST API hosted by a Node.js process. I want to implement a feature where I don't want to allow multiple connections to the broker by a user. I am using auth_opt_http_getuser_uri to get the login request, I verify the request and let the user to connect if the credentials are correct. I want to cache or store the session information about the user and don't want another connection to be made by the same user if it the user is already connected. It is simple to implement if I could find an option that can call an HTTP method when a client is disconnected; I will clear the session/cache in that case, and the user will be able to connect again. I want to know if such option present in the HTTP auth plugin that can call a function when the client is disconnected? Or, could someone suggest me a solution to the problem i.e. don't want to allow multiple connection from the same user.

@iegomez
Copy link
Owner

iegomez commented Oct 4, 2023

I don't know why you want to limit connections to the broker itself, but you're probably better off handling it there.
So I'd recommend forking the plugin and implementing it at this level, your http backend shouldn't worry about connections to the broker.

@irfanazam1
Copy link
Author

I want to do that to safeguard another connection in case our device password is leaked. I can implement that but I don't know how the broker will call the disconnect function on the plugin interface?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants