百度智能云

All Product Document

          IoT Core

          Connect and Receive and Send Messages by MQTT Simulator

          The application client configured with MQTT can verify quickly whether it can send or receive messages alternatively with IoT Core service.

          Precondition

          Log into the MQTT.fx official website, and find a suitable MQTT.fx client version to download and install.

          Note: The bug appears when using MQTT.fx 1.7.0 version to process the topics with $, so please avoid testing with this version. Click to check MQTT.fx Official issue

          Operation Steps

          1. Create configuration files

          Open the setup page of MQTT client, click “+“ button to create a new configuration file.

          image.png

          • Fill the basic information:
          Parameter name Description
          profile name The name of configuration file can be entered randomly
          Broker Address You can find in the detailed page of IoT Core
          Or, you can splice through IoTCoreId+ .iot.+Region+.baidubce.com
          Where Region can be selected when creating IoT Core: Guangzhougz,Beijingbj
          Broker Port TCP:1883、SSL:1884、WSS:443
          Client ID Client ID, suggest keeping it the same as the device name. Support the “a-z”,“0-9”,“_”,“-” characters
          no more than 128bytes, UTF8 coding, unduplicated names
          • Select User Credential, and enter the username/password got in the widget in the previous step.
          • To test SSL/TLS encrypted connection, you need to use 1884 port and check Enable SSL/TLSto select CA Signed Server Certificate.

            Click “Apply” button, to complete the client configuration.

          2. Connection

          Return to the MQTT client interface, select the configuration file created in the previous step, and click the “connect " button to connect to the service.

          When the connection succeeds, the status indicator on the right of the interface will also light up.

          3. Subscription topic

          The information starts to be subscripted after connecting successfully.

          image.png

          Open the Subscribe tag, enter the topic; for example, we use the testing topic created in previous step here, what corresponds to this device is $iot/device1/user/fortest, with the default QoS 0 selected, and click “Subscribe” to complete the subscription.

          4. Release the message

          Open Publish tag, enter the topic, such as $iot/device1/user/fortest, select default QoS 0, and enter the following information in the input box

          { 
              "temperature": 26, 
              "humidity": 45 
          } 

          image.png

          5. View the messages subscribed

          Return to Subscribe interface, you will see the subscription information received, and we have subscribed the Pub data, please see the figure below. Further, you can try other topics as well, and you shall note that the corresponding message is forwarded to the topics with Sub privilege through the rule engine, and then it can be subscribed on the client.

          image.png

          At this point, you are ready to use the basic capabilities of IoT Core.

          Previous
          Access Connection Information
          Next
          Use the Rule Engine to Transfer the Device Information to Business Server