You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Publish method will look like this (I added semaphore because MqttClient is not thread safe to avoid sending too many requests at a time):
staticSemaphoreSlimsemaphoreSlim=new SemaphoreSlim(1,1);publicasync Task Publish(stringtopic,stringmessage){await semaphoreSlim.WaitAsync();try{await mqttClient.PublishStringAsync(topic, message);}finally{//Very important to release
semaphoreSlim.Release();}}
Handling state of client in the scenario above (when it is disconnected) similar question to here. I'm mentioning since there are a lot of comments in issues stating that ManagedClient is not stable so I would like to stick with low level one.
Which project is your question related to?
Client
The text was updated successfully, but these errors were encountered:
Describe your question
I have two questions regarding propper implementation of two simple (from description point of view) features.
As per documentation this ref repo is propper way of implementing client in .net core.
I will inject it via provider as in repo
Publish method will look like this (I added semaphore because MqttClient is not thread safe to avoid sending too many requests at a time):
Which project is your question related to?
The text was updated successfully, but these errors were encountered: