EMQPUBOPEN – create a publish message topic

Create and view publish message topics, which will enable you to publish data to things in AWS IoT Console.

Type Syntax Response
Test

AT+EMQPUBOPEN=?

OK

 

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

Read

AT+EMQPUBOPEN?

List of publish topics.

OK

 

+EMQPUBOPEN topics:

0 <publishtopic0>/<AWSthingName>

1 <publishtopic1>/<AWSthingName>

2 null

3 null

4 null

5 null

6 null

7 null

where:

  • 0, 1, and so on are the index numbers
  • <publishtopicn> is the unique name for each publish 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+EMQPUBOPEN=(0-7),<topic>

where:

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

OK

 

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

where

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

or

ERRORthe command failed

Example

AT+EMQPUBOPEN=1,PublishToCloud1

OK

 

+EMQPUBOPEN: 1,0

 

AT+EMQPUBOPEN?

OK

 

+EMQPUBOPEN topics:

0 PublishToCloud0/AWSthingName

1 PublishToCloud1/AWSthingName

2 null

3 null

4 null

5 null

6 null

7 null