A.1 AE Registration and creation of a container child resource
Figure A.1-1 illustrates a message flow for registration of an ADN-AE to an IN-CSE as described in clause 7.3.5.2.1 of oneM2M TS-0004 [5] with WebSocket mapping and subsequent creation of a <container> child resource.
Figure A.1-1: Message flow for registration of an ADN-AE to an IN-CSE
In the considered example, the WebSocket protocol is used to send JSON serialized request and response primitives in text format.
The message flow may look as follows:
- TCP connection establishment and Security Association Establishment as defined in oneM2M TS-0003 [4] based on TLS handshake procedure is accomplished.
-
The WSS client sends e.g. the following opening handshake message, offering to use either JSON or XML serialization of primitives:
-
The WSS server selects use of JSON serialization and responds the following handshake message:
-
The AE sends the following request primitive in textual JSON serialized format:
{ "op": 1, "to": "//example.net/mncse1234", "rqi": "A1000", "rcn": 7, "pc": { "m2m:ae": { "rn": "SmartHomeApplication", "api": "Na56", "apn": "app1234" } }, "ty": 2 }
The above JSON object is mapped by the WS client into a data frame of the WebSocket Framing protocol in utf-8 text format, the 4-bit opcode in the WebSocket Base Framing Protocol of the first message fragment is set to x1 ("text frame").
-
The IN-CSE validates the privilege of the originator to create an <AE> resource, and accepts the request to create the resource.
-
The IN-CSE acknowledges the success of the request by responding the following JSON serialized response primitive. The response primitive includes all attributes of <AE> instance created in Step 5.
Note
JSON serialized primitives are not encapsulated under member names "m2m:rqp" and "m2m:rsp" as in XML serialized representations, which allows differentiation between request and response primitives (see clause 8.4 of TS-0004 [5]). JSON serialized primitives can be differentiated by the presence of mandatory members such as "op" in request primitives (see step 4) above), and "rsc" in response primitives.
The above JSON object is mapped by the WS server into a data frame of the WebSocket Framing protocol in utf-8 text format, the 4-bit opcode in the WebSocket Base Framing Protocol of the first message fragment is set to x1 ("text frame").
-
The AE sends in textual JSON serialized format the following request primitive to create a <container> resource as child resource of the <AE> created in Step 5:
json { "op": 1, "to": "//example.net/mncse1234/SmartHomeApplication", "fr":"S\_SAH25", "rqi": "A1001", "rcn": 7, "pc": { "m2m:cnt": { "rn": "SmartHomeContainer", "mbs": 100000, "mni": 500 } }, "ty": 3 }
The above JSON object is mapped by the WS client into a data frame of the WebSocket Framing protocol in utf-8 text format, the 4-bit opcode in the WebSocket Base Framing Protocol of the first message fragment is set to x1 ("text frame").
-
The IN-CSE validates the privilege of the originator to create an <container> resource under the <AE> resource created in step 5, and accepts the request to create the resource.
-
The IN-CSE acknowledges the success of the request by responding the following JSON serialized response primitive:
json { "rsc": 2001, "rqi": "A1001", "pc": { "m2m:cnt": { "rn": "SmartHomeContainer", "ty": 3, "ri": "cnt1", "pi": "ae1", "ct": "20160506T154048", "lt": "20160506T154048", "acpi": [ "acp1" ], "et": "20180506T154048", "cr": " S_SAH25", "st": 0, "mni": 500, "mbs": 100000, "cni": 0, "cbs": 0, "mia": 3600 } } }
The above JSON object is mapped by the WS server into a data frame of the WebSocket Framing protocol in utf-8 text format, the 4-bit opcode in the WebSocket Base Framing Protocol of the first message fragment is set to x1 ("text frame"). 1. Primitives of further subsequent CRUDN procedures may be transferred on the existing WebSocket connection.