I have to create a very basic Mqtt broker-client demo I have therefore followed and downloaded this example.
It works perfectly but it is a console application with Net5.0.
I have to make it work on a wpf 4.5.2. solution.
That should be possible according to this
So taking as example the solution above
I have created a project of my own with the same referencies
Per each project I have also added the correct using statements as in the example.
So everything should be correct but when I paste the code for the Server I get those errors
MqttServerOptionsBuilder options = new MqttServerOptionsBuilder()
.WithDefaultEndpoint()
.WithDefaultEndpointPort(707)
.WithConnectionValidator(OnNewConnection)
.WithApplicationMessageInterceptor(OnNewMessage);
IMqttServer mqttServer = new MqttFactory().CreateMqttServer();
and also for the client I get other errors
Where is the problem? Thanks
---ADD---
As requested here are the errors
(1) Error CS1061 'IManagedMqttClient' does not contain a definition for 'ConnectedHandler' and no accessible extension method 'ConnectedHandler' accepting a first argument of type 'IManagedMqttClient' could be found (are you missing a using directive or an assembly reference?) Client C:\Development\MqttDemo\MqttDemo\Client\MainWindow.xaml.cs 43 25 IntelliSense Active
(2) Error CS0246 The type or namespace name 'MqttClientConnectedHandlerDelegate' could not be found (are you missing a using directive or an assembly reference?) Client C:\Development\MqttDemo\MqttDemo\Client\MainWindow.xaml.cs 43 48 IntelliSense Active
(3) Error CS0103 The name 'OnConnected' does not exist in the current context Client C:\Development\MqttDemo\MqttDemo\Client\MainWindow.xaml.cs 43 83 IntelliSense Active
(4) Error CS1061 'IManagedMqttClient' does not contain a definition for 'DisconnectedHandler' and no accessible extension method 'DisconnectedHandler' accepting a first argument of type 'IManagedMqttClient' could be found (are you missing a using directive or an assembly reference?) Client C:\Development\MqttDemo\MqttDemo\Client\MainWindow.xaml.cs 44 25 IntelliSense Active
(5) Error CS0246 The type or namespace name 'MqttClientDisconnectedHandlerDelegate' could not be found (are you missing a using directive or an assembly reference?) Client C:\Development\MqttDemo\MqttDemo\Client\MainWindow.xaml.cs 44 51 IntelliSense Active
(6) Error CS0103 The name 'OnDisconnected' does not exist in the current context Client C:\Development\MqttDemo\MqttDemo\Client\MainWindow.xaml.cs 44 89 IntelliSense Active
(7) Error CS1061 'IManagedMqttClient' does not contain a definition for 'ConnectingFailedHandler' and no accessible extension method 'ConnectingFailedHandler' accepting a first argument of type 'IManagedMqttClient' could be found (are you missing a using directive or an assembly reference?) Client C:\Development\MqttDemo\MqttDemo\Client\MainWindow.xaml.cs 45 25 IntelliSense Active
(8) Error CS0246 The type or namespace name 'ConnectingFailedHandlerDelegate' could not be found (are you missing a using directive or an assembly reference?) Client C:\Development\MqttDemo\MqttDemo\Client\MainWindow.xaml.cs 45 55 IntelliSense Active
(9) Error CS0103 The name 'OnConnectingFailed' does not exist in the current context Client C:\Development\MqttDemo\MqttDemo\Client\MainWindow.xaml.cs 45 87 IntelliSense Active
(10) Error CS1061 'IManagedMqttClient' does not contain a definition for 'ApplicationMessageReceivedHandler' and no accessible extension method 'ApplicationMessageReceivedHandler' accepting a first argument of type 'IManagedMqttClient' could be found (are you missing a using directive or an assembly reference?) Client C:\Development\MqttDemo\MqttDemo\Client\MainWindow.xaml.cs 47 25 IntelliSense Active
(11) Error CS0246 The type or namespace name 'MqttApplicationMessageReceivedHandlerDelegate' could not be found (are you missing a using directive or an assembly reference?) Client C:\Development\MqttDemo\MqttDemo\Client\MainWindow.xaml.cs 47 65 IntelliSense Active
(12) Error CS1061 'IManagedMqttClient' does not contain a definition for 'PublishAsync' and no accessible extension method 'PublishAsync' accepting a first argument of type 'IManagedMqttClient' could be found (are you missing a using directive or an assembly reference?) Client C:\Development\MqttDemo\MqttDemo\Client\MainWindow.xaml.cs 56 29 IntelliSense Active