10
Discussion on Fragmentation & Content Format Negotiation in MQTT Binding ce: Sung-Chan Choi, Yong-Suk Park, Jaeho Kim ([email protected]) : 2015-03-23 PRO-2015-0739- Discussion_on_fragmentation_&_content_format_negotiation_in _MQTT_binding

Discussion on Fragmentation & Content Format Negotiation in MQTT Binding Source: Sung-Chan Choi, Yong-Suk Park, Jaeho Kim ([email protected]) Data: 2015-03-23

Embed Size (px)

Citation preview

Page 1: Discussion on Fragmentation & Content Format Negotiation in MQTT Binding Source: Sung-Chan Choi, Yong-Suk Park, Jaeho Kim (csc@keti.re.kr) Data: 2015-03-23

Discussion on Fragmentation & Content Format Negotiation in MQTT Binding

Source: Sung-Chan Choi, Yong-Suk Park, Jaeho Kim ([email protected])Data: 2015-03-23

PRO-2015-0739-Discussion_on_fragmentation_&_content_format_negotiation_in_MQTT_binding

Page 2: Discussion on Fragmentation & Content Format Negotiation in MQTT Binding Source: Sung-Chan Choi, Yong-Suk Park, Jaeho Kim (csc@keti.re.kr) Data: 2015-03-23

Fragmentation Issue

• TS-0010 describes– Note: MQTT packets are subjected to a theoretical

maximum message size of 256MB, but it is good practice not to send packets that are bigger than a 100kB. If a larger amount of data needs to be sent, it should be segmented into multiple PUBLISH packets.

Page 3: Discussion on Fragmentation & Content Format Negotiation in MQTT Binding Source: Sung-Chan Choi, Yong-Suk Park, Jaeho Kim (csc@keti.re.kr) Data: 2015-03-23

MQTT Fragmentation

Fixed Variable Payload

MQTT Message Format

• In order to reassemble fragmented application messages which are delivered over MQTT payload, when the application message is to be fragmented, there need to express the information about fragmented sequence number, flag indicating more fragmented message following or not, ..

• And this information may be included in MQTTT Payload part

Page 4: Discussion on Fragmentation & Content Format Negotiation in MQTT Binding Source: Sung-Chan Choi, Yong-Suk Park, Jaeho Kim (csc@keti.re.kr) Data: 2015-03-23

MQTT Fragmentation

MQTT Client MQTT Client

• Identification• Fragmented Data Sequence Number• More Fragmented Data Indication

Flag• Fragmented Data Size

Frag4 Frag3 Frag2 Frag1

Each Fragmentation data may need following information

Frag1Frag2Frag3Frag4

MQTT Broker

Page 5: Discussion on Fragmentation & Content Format Negotiation in MQTT Binding Source: Sung-Chan Choi, Yong-Suk Park, Jaeho Kim (csc@keti.re.kr) Data: 2015-03-23

Example

MQTT Client MQTT ClientApplication data size: 200KBFragmentation data size: 50KB

PUBLISH #w77e/0/1/51200

PUBLISH #w77e/1/1/51200

PUBLISH #w77e/2/1/51200

PUBLISH #w77e/3/0/51200

ID/SequenceNumber/MoreFlag/FragmentDataSize

MQTT Broker

Page 6: Discussion on Fragmentation & Content Format Negotiation in MQTT Binding Source: Sung-Chan Choi, Yong-Suk Park, Jaeho Kim (csc@keti.re.kr) Data: 2015-03-23

Content Format Negotiation• In HTTP binding, for negotiation, it uses “Accept” and

“Content-type” in HTTP Header Fields• In MQTT binding TS-0010, section 6.5.3 content

format negotiation describes the similar concept as in HTTP binding

• To this end, we can define parameters for example,– MQ-M2M-ACCEPT– MQ-M2M-DATATYPE

• And this information could be included in MQTT payload

Page 7: Discussion on Fragmentation & Content Format Negotiation in MQTT Binding Source: Sung-Chan Choi, Yong-Suk Park, Jaeho Kim (csc@keti.re.kr) Data: 2015-03-23

Example

MQTT Client MQTT Client

PUBLISH MQ-M2M-ACCEPT=“application/onem2m-res+xml” MQ-M2M-DATATYPE=“application/onem2m-res+xml”

MQTT Broker

PUBLISH MQ-M2M-DATATYPE=“application/onem2m-res+xml”

Request

Response

Page 8: Discussion on Fragmentation & Content Format Negotiation in MQTT Binding Source: Sung-Chan Choi, Yong-Suk Park, Jaeho Kim (csc@keti.re.kr) Data: 2015-03-23

Protocol Binding

• Option1– Allocate bytes in MQTT payload for fragmentation

& content format negotiation information and save the information as string data format

MQTT Payload

Fragmentation Part Negotiation Part

“#w77e/0/1/51200” “MQ-M2M-ACCEPT=application/onem2m-res+xml, MQ-M2M-DATATYPE=application/onem2m-res+xml”

Page 9: Discussion on Fragmentation & Content Format Negotiation in MQTT Binding Source: Sung-Chan Choi, Yong-Suk Park, Jaeho Kim (csc@keti.re.kr) Data: 2015-03-23

Protocol Binding

• Option2– Allocate MQTT payload byte in more detail for

each fragmentation & content format negotiation information

MQTT Payload

Fragmentation Part Negotiation Part

ID Sequence Number More Flag FragmentDataSize

10bytes 20bytes 1bytes 30bytesExample

Page 10: Discussion on Fragmentation & Content Format Negotiation in MQTT Binding Source: Sung-Chan Choi, Yong-Suk Park, Jaeho Kim (csc@keti.re.kr) Data: 2015-03-23

Protocol Binding

MQTT Payload

Fragmentation Part Negotiation Part

MQ-M2M-ACCEPT MQ-M2M-DATATYPE

30bytes 30bytesExample