azure - Instantiate DeviceClient with IoT Hub -


i have console app sends commands directly raspberry pi via azure iot hub. works fine.

where confused though, on 2 different ways (possibly more?) instantiate deviceclient.

ex:

    deviceclient = deviceclient.create(iot_hub_host_name, authenticationmethodfactory          .createauthenticationwithregistrysymmetrickey(iot_hub_device, iot_device_key), transporttype.http1); 

or

deviceclient = deviceclient.createfromconnectionstring(iot_hub_conn_string); 

seem same thing.

why use 1 on other? can receive messages either way.

yes, in end of day have same result.

https://github.com/azure/azure-iot-sdks/blob/master/csharp/device/microsoft.azure.devices.client/deviceclient.cs

create(...) method invokes iothubconnectionstringbuilder.create(...) createfromconnectionstring(...) , has description method creates deviceclient individual parameters.

so, believe, create 1 kind of wrapper gets parameters, creates connection string individual params , passes createfromconnectionstring(...). so, main difference, think, performance.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -