# MQTT Access Instructions
The test access process include platform domain and device domain, to help you experience the first access to gain a general understanding of functions and access protocol of the platform.
Test flow chart
Access steps are as follows:
Step1 Create product and select access protocol
First you need to create product with access protocol is MQTT on the platform, see Product Create
After product creation, record its product ID
Step2 Create device, record device ID and other information
There are two ways to create device:
The first one, click add device on the page, input device name and authentication information (i.e. device number). For specific platform resource model, refer to Chapter I Resource Model, and record the device number .
The second one, create device by calling API for device creation, input the device name, access protocol, authentication information, MasterKey and other information to create device on the platform.
Step3 Establish protocol connection between device and the platform
MQTT server address domain name is: iot.zong.com.pk:6002
Use parameters in Step1 and step2 as login parameters, use corresponding interface in SDK to organize MQTT connection message, send it to the platform, and establish MQTT connection with the platform
If connection succeeds, an online token will be seen in device information:
Step4 Creat datastream, upload datapoint
Write code to upload data to the platform using interface functions provided in SDK
Step5 Display datastream, view datapoints
Click data display under device management on OneNET, enter the data display page, click and drop-down menu to view recently uploaded datapoints, or select the time interval to view historical time
Q1: During MQTT connection authentication, what to fill respectively for ClientIdentifier; UserName; UserPassword in Payload?
A: ClientIdentifier: Device ID obtained when create device, is a numeric string;
UserName: Product ID assigned by the platform when register product, is a numeric string; 。 UserPassword: Device authentication information (i.e. unique device number, SN) or apiKey, is a string.
Q2: Does MQTT need connection authentication before it can send other messages?
A: Yes, MQTT protocol must be authenticated (after receiving ConnAck) before it can send subsequent messages for interaction, otherwise the server will discard messages directly.
Q3: What are limitations on the topic the MQTT can subscribe? A: OneNET does not support subscribing to system Topic that start with $.
Q4: How to upload data to cloud platform using MQTT protocol? A: After device completes connection authentication, it packages data in certain format (see protocol file description) and publishes the data to Topic of the $dp system.
Q5: Does Topic need to be created before subscription? A: When the device perform subscribes, OneNET will automatically determine whether Topic exists. If not, Topic will be created automatically.
Q6: Can the device obtain datastream information of other devices through subscription? A: Yes, the latest device data point information can be obtained timely by subscribing /device_id/ datastream name.
Q7: What are limitations on device publishing messages (Publish)?? A: Publishing messages can only be conduct under the same product ID, and Publish messages cannot be pushed across products.