MQTTS-Verify Server and Client 통신연습
MQTT (Message Queuing Telemetry Transport) is a lightweight broker-based publish/subscribe messaging protocol.
It is a machine-to-machine (M2M)/”Internet of Things” connectivity protocol.
It was designed as an extremely lightweight publish/subscribe messaging transport.
It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium.
1. 통신시스템: MQTTS-Verify Server and Client
2. 명령시퀀스: MQTTS-Verify Server and Client
| No | Command | Response | Description |
| 1 | PDP Context 설정 | ||
| 2.1 |
AT+CCERTDOWN= “server_ca.pem”,1602 |
||
| 3.1 |
AT+CCERTDOWN= “client_cert.pem”,1740 |
||
| 4.1 |
AT+CCERTDOWN= “client_cert.key.pem”,8383\r |
||
| – | AT+CCERTLIST | ||
| – | AT+CCERTDELE=”server_ca.pem” | ||
| 5 | AT+CSSLCFG=”sslversion”,0,4\ | Set the SSL version of the first SSL context | |
| 6 | AT+CSSLCFG=”authmode”,0,1 |
Set the authentication mode(verify server) of the first SSL context |
|
| 7 |
AT+CSSLCFG=”cacert”,0, “server_ca.pem” |
||
| 8 | AT+CSSLCFG=”clientcert”,0,”cert.pem”\r | ||
| 9 | AT+CSSLCFG=”clientkey”,0,”cert.key.pem”\r | ||
| 10 | AT+CMQTTSTART |
+CMQTTSTART: 0 OK |
Start MQTT service, activate PDP context |
| 11 | AT+CMQTTACCQ=0, “client test0” | OK |
Acquire one client which will connect to a MQTT server without SSL/TLS. |
| 12 | AT+CMQTTSSLCFG=0,0 | OK |
Set the first SSL context to be used in the SSL connection |
| 13.1 | AT+CMQTTWILLTOPIC=0,10 | > | Set the topic of the will |
| 13.2 | >Topic_will | OK | Input 10 Character as topic |
| 14.1 | AT+CMQTTWILLMSG=0,6,1 | > | Set the will message |
| 14.2 | >qwerty | OK | Input 6 Character |
| 15 |
AT+CMQTTCONNECT=0, “tcp://hooleeping.com:8883”,60,1 |
OK +CMQTTCONNECT: 0,0 |
Connect to a MQTT server, input the right server and port. |
| 16.1 | AT+CMQTTTOPIC=0,13 | > | Set the topic for the PUBLISH message |
| 16.2 | >dddrrrggghhhk | OK | Input topic to publish |
| 17.1 | AT+CMQTTPAYLOAD=0,60 | > | Set the payload for the PUBLISH message |
| 17.2 |
>012345678901234567890123456789 012345678901234567890123456789 |
OK | Input message |
| 18 | AT+CMQTTPUB=0,1,60 | Publish a message | |
| 19.1 | AT+CMQTTSUBTOPIC=0,9,1 | > | Set one topic for the SUBSCRIBE message |
| 19.2 | >123456789 | OK | |
| 20 | AT+CMQTTSUB=0 | OK +CMQTTSUB: 0,0 |
Subscribe a message |
| 20.1 | AT+CMQTTSUB=0,9,0 | > | |
| 20.2 | >simcommsg | ||
| 21.1 | AT+CMQTTUNSUB=0,9,0 | > | Unsubscribe one topic from the server |
| 21.2 | >simcommsg |
OK +CMQTTUNSUB: 0,0 |
|
| 23 | AT+CMQTTDISC=0,120 |
OK +CMQTTDISC: 0,0 |
Disconnect from server |
| 24 | AT+CMQTTREL=0 | OK | Release the client |
| 25 | AT+CMQTTSTOP |
+CMQTTSTOP: 0 OK +CMQTTNONET |
Stop MQTT Service |
