public async Task HandleClientDisconnectedAsync(MqttServerClientDisconnectedEventArgs eventArgs)
        {
            Debug.WriteLine($"Client disconnected {eventArgs.ClientId}");
            await _mqttServer.ClearRetainedApplicationMessagesAsync();

            try
            {
                await _restClient.DisableLightPoint(Guid.Parse(eventArgs.ClientId));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Пример #2
0
        private static async void ShutdownServer()
        {
            try
            {
#if MQTTNET3
                await _mqttServer.ClearRetainedApplicationMessagesAsync();
#else
                await _mqttServer.ClearRetainedMessagesAsync();
#endif
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }

            await _mqttServer.StopAsync();
        }
Пример #3
0
 public Task ClearRetainedApplicationMessagesAsync()
 {
     return(_mqttServer.ClearRetainedApplicationMessagesAsync());
 }