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

Send message on to client after connection #1435

Closed
fogzot opened this issue Jun 17, 2022 · 7 comments
Closed

Send message on to client after connection #1435

fogzot opened this issue Jun 17, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@fogzot
Copy link
Contributor

fogzot commented Jun 17, 2022

Describe the feature request

I am trying to publish a message just after a client connects and subscribes to a specific topic. The message is intended to send initial configuration to the client, so it is important that the client receives it. I tryied injecting a message using InjectApplicationMessage from the ClientSubscribedTopicAsync event but the client does not receive the message.

Which project is your feature request related to?

  • Server

Describe the solution you'd like

It would be nice if ClientSubscribedTopicAsync could be called after setting up the client subscription and make sure that messages generated on the server are correctly delivered.

Note: I am using version 4.0.0 of MQTTnet; in version 3 this worked.

@fogzot fogzot added the feature-request New feature or request label Jun 17, 2022
@fogzot
Copy link
Contributor Author

fogzot commented Jun 20, 2022

Additional information: injecting the message in a different task that delays even as little as 1ms is enough for the client to receive the message. It seems that when OnClientSubscribedTopic is called the client is not yet subscribed and the message gets lost. I'd like the message to not be lost or, at least, to use an informative name for the event, like ClientSubscribingTopicAsync.

@chkr1011 chkr1011 added bug Something isn't working and removed feature-request New feature or request labels Jun 20, 2022
@chkr1011
Copy link
Collaborator

I fixed this issue. Please test with version 4.0.2.192 from the MyGet feed (see readme) and let me know if it works. No delay etc. is required. The event was just fired at the wrong time (as you already mentioned).

@fogzot
Copy link
Contributor Author

fogzot commented Jun 21, 2022

The readme does not contain any reference to a MyGet feed.

@MD-V
Copy link
Contributor

MD-V commented Jun 21, 2022

@fogzot
Copy link
Contributor Author

fogzot commented Jun 21, 2022

My fault. I used Ctrl-F on the homepage and found nothing. :(

@fogzot
Copy link
Contributor Author

fogzot commented Jun 21, 2022

And I confirm it works. Great, thanks.

@fogzot fogzot closed this as completed Jun 21, 2022
@qcjxberin
Copy link

I feel that it is not as convenient to use as before, and the new one does not know what to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants