EMQSUBOPEN – create a subscribe message topic

Create and view subscribe message topics, which will enable you to send data from AWS to your thing.

Type Syntax Returned Result
Test

AT+EMQSUBOPEN=?

OK

 

+EMQSUBOPEN:(0-7),<topic>

+EMQSUBOPEN: "topiclist"

Read

AT+EMQSUBOPEN?

List of subscribe topics.

OK

 

+EMQSUBOPEN topics:

0 <subscribetopic0>/<AWSthingName>

1 <subscribetopic1>/<AWSthingName>

2 null

3 null

4 null

5 null

6 null

7 null

where:

  • 0, 1, and so on are the index numbers
  • <subscribetopicn> is the unique name for each subscribe index
  • <AWSthingName> is the unique name for the thing that you defined in AWS. For more information, see Available files and sizes.

    The AWSthingName has a maximum length of 128 characters. The sum of <publishtopicn> and <AWSthingName> must not exceed 255 characters. Escaped characters count as 1 character each.

  • null is an empty publish topic
Write

AT+EMQSUBOPEN=(0-7), <topic>

where:

  • (0-7) is a subscribe index number in the range from 0, up to and including 7.
  • <topic> is the subscribe topic title with a maximum length of 255 characters (including /AWS thingName or /IMEI). Topic titles cannot contain special characters.

OK

+EMQSUBOPEN: (0-7),<status>

where

  • (0-7) is the subscribe index number you selected from the range
  • <status> is:
    • 0 – successfully installed the subscribe topic
    • -1AWS rejected the subscribe request
    • -2 – socket already in use

or

ERRORthe command failed

Example

AT+EMQSUBOPEN=1,SubscribeFromCloud1

OK

 

+EMQSUBOPEN: 1,0

 

AT+EMQSUBOPEN?

OK

 

+EMQSUBOPEN topics:

0 SubscribeFromCloud0/AWSthingName

1 SubscribeFromCloud1/AWSthingName

2 null

3 null

4 null

5 null

6 null

7 null