How to create "CONNECT" from Client to Broker?

29 views
Skip to first unread message

Handkie Mak

unread,
Mar 7, 2016, 10:45:30 PM3/7/16
to MQTT
Hi All~!

I would like to make the communication between:
Client(Wi-Fi Module, by using AT command) <------> Broker(MQTTCloud) 

MQTT information:
Server IP: 54.92.237.174
User: ynxbaern
Password :cctdGq-Go7Ce
Port: 10250

Testing Diagram: 
PC<----(Serial)---->WI-Fi Module(Station mode, TCP client) <---(Wi-Fi)---> AP <---->Internet <~~~~~~~~> Broker

In Serial Terminal,
//////////////////Connect to AP///////////////////
at+wset=0,SSID
at+wsec=0,,PASSWORD
at+wnet=1
at+wjoin
//////////////////Connect TCP Client to Broker///////////////////
AT+SCON=SO,TCN,54.92.237.174,10250,,0 
////////////////Send "Connect" MQTT message to Broker///////////////////
AT+SSEND=0,,,95
%10%3e%00%04%4D%51%54%54%04%Ce%00%0AHandkie8911111111111111ABChi%02ynxbaern%00%0c%cctdGq-Go7Ce
//////////////////////////////////////////////////////////////////////////

As I know the message flow of MQTT is 1. TCP, 2.CONNECT, 3. CONNACK 4......................
Right now, I stopped in Step 2.
After the TCP client connection is made and I send 95 Byte data size to Broker
%10%3e%00%04%4D%51%54%54%04%Ce%00%0AHandkie8911111111111111ABChi%02ynxbaern%00%0c%cctdGq-Go7Ce

It is included Fixed header+ Variable header+ Payload
Fixed header: 0X10,0X3e 
Variable header: 0X00,0X04,0X4D,0X51,0X54,0X54,0X04,0XCe,0X00,0X0A
Payload:
Client Identifier: Handkie8911111111111111
Will Topic: ABC
Will Message: hi 
User Name: ynxbaern
Password: cctdGq-Go7Ce

Is it possible to create the connection by using a string method to send data from client to broker?
or is the string have any missing data or my concept is wrong?
Due to some limitation, I cannot use the MQTT clinet library coding.

Thanks


Reply all
Reply to author
Forward
0 new messages