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

WithApplicationMessageInterceptor on v4 #2051

Open
wootapa opened this issue Jul 19, 2024 · 5 comments
Open

WithApplicationMessageInterceptor on v4 #2051

wootapa opened this issue Jul 19, 2024 · 5 comments
Labels
question It is a question regarding the project

Comments

@wootapa
Copy link

wootapa commented Jul 19, 2024

Trying to find the server event in version 4, that is the equivalent of what is mentioned here: #1467, but I cant find anything. I would like to intercept messages based on the receiving client. Could you give a hint?

@wootapa wootapa added the question It is a question regarding the project label Jul 19, 2024
@SeppPenner
Copy link
Collaborator

Take a look at

public static class Server_Intercepting_Samples

@wootapa
Copy link
Author

wootapa commented Jul 19, 2024

That's what I've used but InterceptingPublishAsync fires once per message. I would like to filter each message once per client, so I can reject based on client conditions. Possible?

@SeppPenner
Copy link
Collaborator

I'm not sure if this is possible...

@Jeanot-Zubler
Copy link

use server.InterceptingClientEnqueueAsync

@wootapa
Copy link
Author

wootapa commented Jul 26, 2024

That's the one. Thanks.
I also looked through the code to find a way to limit the retained messages upon subscription, but they seem filtered only based on the topic here MqttClientSubscription.FilterRetainedApplicationMessages

subscribeResult.RetainedMessages.Add(retainedMessageMatch);

It could possibly make sense to also have a hook here, basically doing the same thing as in server.InterceptingClientEnqueueAsync as a way to opt out for a specific message. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question It is a question regarding the project
Projects
None yet
Development

No branches or pull requests

3 participants