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
i did a simple test (which work with MQTTnet but do not work with emitter - can you make it working)
--------------- code ----------------------
using System;using System.Text;using System.Threading;using Emitter;using Emitter.Messages;using System.Security.Cryptography.X509Certificates;namespaceEmitterMQTTMossquitto{classProgram{staticvoidMain(string[]args){MqttClientclient=null;stringclientId;X509CertificatecaCert=new X509Certificate(Encoding.UTF8.GetBytes(GetCertificate));// connect to the Mosquito test serverclient=new MqttClient("test.mosquitto.org",8883,true, caCert,null, MqttSslProtocols.TLSv1_2);// use a unique id as client id, each time we start the applicationclientId= Guid.NewGuid().ToString();
Console.WriteLine("Connecting to Mosquito test server...");
client.Connect(clientId);
Console.WriteLine("Connected to Mosquito test server");while(true){// send random temperature value to Gauge demo in Mosquito test server, see http://test.mosquitto.org/gauge/
client.Publish("temp/random", GetRandomTemperature(), MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE,false);// the Mosquito test server has a local process that updates every 15 seconds, so we just follow that
Thread.Sleep(15000);}}privatestaticbyte[]GetRandomTemperature(){// generate random valueRandomrandomProvider=new Random();varrandomTemperature= randomProvider.NextDouble()*10;// convert to string formatted NN.NNvartemperatureAsString= randomTemperature.ToString("N2");
Console.WriteLine($"Temperature: {temperatureAsString}");return Encoding.UTF8.GetBytes(temperatureAsString);}// Mosquito test server CA certificate// from http://test.mosquitto.org/// X509 staticstringGetCertificate=@"-----BEGIN CERTIFICATE-----MIIC8DCCAlmgAwIBAgIJAOD63PlXjJi8MA0GCSqGSIb3DQEBBQUAMIGQMQswCQYDVQQGEwJHQjEXMBUGA1UECAwOVW5pdGVkIEtpbmdkb20xDjAMBgNVBAcMBURlcmJ5MRIwEAYDVQQKDAlNb3NxdWl0dG8xCzAJBgNVBAsMAkNBMRYwFAYDVQQDDA1tb3NxdWl0dG8ub3JnMR8wHQYJKoZIhvcNAQkBFhByb2dlckBhdGNob28ub3JnMB4XDTEyMDYyOTIyMTE1OVoXDTIyMDYyNzIyMTE1OVowgZAxCzAJBgNVBAYTAkdCMRcwFQYDVQQIDA5Vbml0ZWQgS2luZ2RvbTEOMAwGA1UEBwwFRGVyYnkxEjAQBgNVBAoMCU1vc3F1aXR0bzELMAkGA1UECwwCQ0ExFjAUBgNVBAMMDW1vc3F1aXR0by5vcmcxHzAdBgkqhkiG9w0BCQEWEHJvZ2VyQGF0Y2hvby5vcmcwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMYkLmX7SqOT/jJCZoQ1NWdCrr/pq47m3xxyXcI+FLEmwbE3R9vMrE6sRbP2S89pfrCt7iuITXPKycpUcIU0mtcT1OqxGBV2lb6RaOT2gC5pxyGaFJ+hA+GIbdYKO3JprPxSBoRponZJvDGEZuM3N7p3S/lRoi7G5wG5mvUmaE5RAgMBAAGjUDBOMB0GA1UdDgQWBBTad2QneVztIPQzRRGj6ZHKqJTv5jAfBgNVHSMEGDAWgBTad2QneVztIPQzRRGj6ZHKqJTv5jAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAAqw1rK4NlRUCUBLhEFUQasjP7xfFqlVbE2cRy0Rs4o3KS0JwzQVBwG85xgeREyPOFdGdhBY2P1FNRy0MDr6xr+D2ZOwxs63dG1nnAnWZg7qwoLgpZ4fESPD3PkA1ZgKJc2zbSQ9fCPxt2W3mdVav66c6fsb7els2W2Iz7gERJSX-----END CERTIFICATE-----";}}
The text was updated successfully, but these errors were encountered:
i did a simple test (which work with MQTTnet but do not work with emitter - can you make it working)
--------------- code ----------------------
The text was updated successfully, but these errors were encountered: