I'm trying to create a simple MQTT client in PowerShell to receive some messages from a broker. This broker is using a non standard port.
To do that, I followed the instructions I found at https://jackgruber.github.io/2019-06-05-ps-mqtt/
When using the example's code it's working fine but when I'm trying to specify a port like
$MqttClient = [uPLibrary.Networking.M2Mqtt.MqttClient]("mqtt-broker.net",41383)
it throws the error:
Cannot convert the "System.Object[]" value of type "System.Object[]" to type "uPLibrary.Networking.M2Mqtt.MqttClient".
At line:1 char:1
+ $MqttClient = [uPLibrary.Networking.M2Mqtt.MqttClient]("ext.mqtt.drya ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : ConvertToFinalInvalidCastException
Any ideas?