Skip to content

Commit

Permalink
Merge pull request #384 from WildernessLabs/feature/mqtt-tls
Browse files Browse the repository at this point in the history
Update MQTT settings to TLS by default
  • Loading branch information
ctacke authored Oct 24, 2023
2 parents fa6cdc7 + 6165dd2 commit 4122f1c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/Meadow.Core/Configuration/MeadowUpdateSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace Meadow;
internal class MeadowUpdateSettings : IUpdateSettings
{
public bool Enabled { get; set; } = false;
public string UpdateServer { get; set; } = "mqtt-01.meadowcloud.co";
public int UpdatePort { get; set; } = 1883;
public string UpdateServer { get; set; } = "mqtt.meadowcloud.co";
public int UpdatePort { get; set; } = 8883;
public string Organization { get; set; } = "Default organization";
public string RootTopic { get; set; } = "{OID}/ota/{ID};{OID}/commands/{ID}";
public int CloudConnectRetrySeconds { get; set; } = 15;
Expand Down
4 changes: 4 additions & 0 deletions source/Meadow.Core/Update/UpdateService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ private async void UpdateStateMachine()
Resolver.Log.Debug("Creating MQTT client options");
var builder = new MqttClientOptionsBuilder()
.WithTcpServer(Config.UpdateServer, Config.UpdatePort)
.WithTls(tlsParameters =>
{
tlsParameters.UseTls = Config.UpdatePort == 8883;
})
.WithProtocolVersion(MQTTnet.Formatter.MqttProtocolVersion.V500)
.WithCommunicationTimeout(TimeSpan.FromSeconds(30));

Expand Down

0 comments on commit 4122f1c

Please sign in to comment.