Skip to content

6.6 URL format

6.6.1 Introduction

oneM2M defines an MQTT URL format to be used in the pointOfAccess attributes in several entity resource types (e.g. <CSEBase>, <remoteCSE>, <AE>) and in other places where oneM2M allows the use of a URL, for example in the notificationURI attributes of the <subscription> resource type.

6.6.2 MQTT URL formats

oneM2M supports the following MQTT URL formats:

  • mqtt://<authority>
  • mqtts://<authority>
  • mqtt+ws://<authority>
  • mqtt+wss://<authority>
  • mqtt://<authority>/<path>
  • mqtts://<authority>/<path>
  • mqtt+ws://<authority>/<path>
  • mqtt+wss://<authority>/<path>

The <authority> component is defined in clause 3.2 of IETF RFC 3986 [8] and includes the host and optionally the port of the MQTT Server that is to be used.

The formats with the scheme mqtt: indicate that TLS shall not be used when connecting to the MQTT server.

The formats with the scheme mqtts: indicate that TLS shall be used when connecting to the MQTT server.

The formats with the scheme mqtt+ws: indicate that MQTT over WebSocket (no TLS) shall be used when connecting to the MQTT server.

The formats with the scheme mqtt+wss: indicate that MQTT over WebSocket with TLS shall be used when connecting to the MQTT server.

If the <authority> does not contain a port component, then the IANA-registered TCP/IP ports shown in Table 6.6-1 shall be used.

Table 6.6-1: Default port numbers

Scheme Port Number
mqtt: 1883
mqtts: 8883
mqtt+ws: 80
mqtt+wss: 443

The <path>, if present, contains one or more MQTT topic levels (separated by a "/" if there are multiple levels). If the path is present it is preceded by a "/" character to separate it from the authority component. This "/" character is not treated as being part of the path. If the path itself starts with a "/" character this results in the authority component being followed by two "/" characters. A "/" character inside the path may be repeated.

6.6.3 Using an MQTT URL in a pointOfAccess attribute

A pointOfAccess attribute contains a list of one or more strings, each of which indicates a way in which that entity can be addressed. An entity can indicate support for MQTT by including one or more strings that use the formats defined in clause 6.6.2.

If there is a path component in a pointOfAccess string, the path is prepended to the topic strings defined in the present document.

Note

EXAMPLES: An AE with AE-ID of "CAE01" would subscribe to MQTT topic strings as follows: 1. If it has a pointOfAccess string mqtt://myserver.example it would subscribe to oneM2M/req/+/CAE01/# (see clause 6.5.4). 2. If it has a pointOfAccess string mqtt://myserver.example/abc/def it would subscribe to abc/def/oneM2M/req/+/CAE01/#. 3. If it has a pointOfAccess string mqtt://myserver.example//def/ghi it would subscribe to /def/ghi/oneM2M/req/+/CAE01/#. 4. If it has a pointOfAccess string mqtt://myserver.example///uvw//xyz it would subscribe to //uvw//xyz/oneM2M/req/+/CAE01/#.

6.6.4 Using an MQTT URL other than in a pointOfAccess attribute

An MQTT URL that is used anywhere other than in a pointOfAccess attribute shall contain a path component. That path gives the entire MQTT topic string that is to be used (note that the "/" character preceding the path does not form part of the topic string). The structure of that topic string does not have to conform to any of the topic string patterns defined in the present document.

Note

EXAMPLES: 1. The URL mqtt://myserver.example/abc/def refers to the Topic abc/def on the MQTT server hosted on myserver.example. 2. The URL mqtt://myserver.example//def/ghi refers to the Topic /def/ghi on the MQTT server hosted on myserver.example. 3. The URL mqtt://myserver.example///uvw//xyz refers to the Topic //uvw//xyz on the MQTT server hosted on myserver.example.