Skip to content

MQTT binding why publish and subscribe of the same topic #588

@jvermillard

Description

@jvermillard

According to https://www.openmobilealliance.org/release/LightweightM2M/V1_2_1-20221209-A/HTML-Version/OMA-TS-LightweightM2M_Transport-V1_2_1-20221209-A.html#8-0-8-MQTT-Transport-Binding

A LwM2M Server subscribes to "{PREFIX}/lwm2m/rd/#" to receive messages from LwM2M Clients. A LwM2M Server publishes responses to a specific endpoint, {ENDPOINT}, via "{PREFIX}/lwm2m/rd/{ENDPOINT}".

If you structure your topic like this, the server will receive an echo the response message it publishes to the client

Server subscribe to /lwm2m/rd/#
Device A publishes a registration on /lwm2m/rd/A, the server receives the request, and publishes the response on /lwm2m/rd/A

Since the server is subscribed to the wildcard/lwm2m/rd/# it will receive an echo of it's published message.

Is it expected? This is inefficient, because the server will need to discard this message and also the broker will deliver 2 messages in place of 1

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions