Azure has implemented MQTT protocol in its IoTHub so I'm trying to use mosquitto to send messages from my pc. I'm creating azure devices using Device Explorer. In the beginning I generated SAS token from there, but it hasn't the "&skn=" part, so I tried to generate a new SAS using compatible event hub from visual studio. After that i tried to use mosquitto broker to send an MQTT message to my IoTHub using parameters in the CONNECT packet as explained here:
https://azure.microsoft.com/en-us/documentation/articles/iot-hub-devguide/#endpoints
However the connection doesn't work and i don't really know where I'm doing wrong. Using mosquitto_pub debugging I get this output: "Client Mosquitto sending CONNECT Error: The connection was lost" Can you please help me solve this issue? Thanks in advance.
These are my mosquitto command, the first one is with SAS token generated using device explorer, the second using visual studio:
mosquitto_pub -h {IotHub Hostname} -p 8883 -t devices/{deviceId}/messages/events -v -V mqttv311 -i {deviceId} -d -u {Hub Name}.azure-devices.net/{deviceId} -P "HostName={Hub name}.azure-devices.net;DeviceId={deviceId};SharedAccessSignature sr=https%3a%2f%2f{Event hub compatible name}.servicebus.windows.net%2fdevices&sig=k030AmvBkmlNwy%2fLd47N8jQuj808jJg9EXnAGmEUan4%3d&se=2913829726&skn=iothubowner"
mosquitto_pub -h {IotHub Hostname} -p 8883 -t devices/{deviceId}/messages/events -v -V mqttv311 -i {deviceId} -d -u {Hub Name}.azure-devices.net/{deviceId} -P "HostName={Hub name}.azure-devices.net;DeviceId={deviceId};SharedAccessSignature=SharedAccessSignature sr={Hub name}.azure-devices.net%2fdevices%2f{deviceId}&sig=BYvo8GE%2fcOdnD8G3wsP7VElU4SwsVTSaACnif%2ffBj1k%3d&se=1456911258"