leshan icon indicating copy to clipboard operation
leshan copied to clipboard

Support for MQTT instead of COAP in LWM2M 1.1 (as we don't have LWM2M 1.2)

Open Frendzel opened this issue 3 years ago • 8 comments

Hi guys, as we're considering approaches to use MQTT instead of COAP and we do not have support for LWM2M 1.2 we would like to ask about some potential places that could be extended in the code to replace some COAP connectors and add MQTT. What do you think guys? We were asking about mixing COAP with MQTT in the californium project: https://github.com/eclipse/californium/issues/1974 But we would like to consider replacing COAP with MQTT instead of mixing it.

Frendzel avatar Apr 14 '22 09:04 Frendzel

Hi Marcin,

as I wrote in the Californium issue #1974, I think, mixing the protocols requires a lot of know how in both.

Not sure, if leshan offers an alternative way, we will see.

Anyway, once you’re done with Californium #1974, regardless, if you switch to a direct MQTT approach, or whatever, please close the Californium issue, maybe with an final comment.

boaks avatar Apr 14 '22 10:04 boaks

Hi yes @boaks, but please be aware that this time I was asking about basically replacing COAP via MQTT instead of doing it on top of COAP. What do you think about it? Still changes in Californium would be the best?

Frendzel avatar Apr 14 '22 10:04 Frendzel

I was aware of that difference, to use MQTT direct without coap-mapping.

What "works best" is hard to foresee. I lost somehow a couple of years ago the track to LwM2M. I would basically go the way, which is specified in LwM2M. Not sure, which one LwM2M specifies. That doesn't mean, it will be a easy way. In some case the reality will bite back, and you will see, if it's good or bad. It also doesn't mean, that an open source project is already prepared for that. Maybe, you need to contribute much more, than you expect.

boaks avatar Apr 14 '22 10:04 boaks

We don't plan to add support of MQTT in Leshan 2.0.0 because we target LWM2M 1.1 for this version (see https://github.com/eclipse/leshan/issues/1235)

But I have plan about doing a massive refactoring to abstract the transport layer in Leshan (probably a not so easy task :exploding_head: ...) :

  • the idea : https://github.com/eclipse/leshan/issues/1025
  • the plan : https://github.com/eclipse/leshan/issues/1222
  • the current experimentation : https://github.com/eclipse/leshan/pull/1220

If I succeed,

At mid term, this should be the base to provide some kind of experimental new transport binding (maybe TCP or some NIDD transport) or new CoAP binding (some kind of POC not based on californium, but for now AFIAK californium seems to be the best choice for CoAP in java world) for Leshan 2.0.0.

At long term, this should also be as base for MQTT transport binding probably in some kind of Leshan 3.0.0 targeting LWM2M 1.2.

But you could eventually use this API to experiment this transport layer abstraction with MQTT sooner (I mean before we start to works on leshan 3.0.0), this will probably help to define a better abstraction and maybe if decide to contribute your work this could eventually be used as base for MQTT support in Leshan 3.0.0 ?

sbernard31 avatar Apr 19 '22 08:04 sbernard31

@Frendzel do you test #1220 ? just to know if you managed to make something with it and so if the abstraction goes in the right direction ?

sbernard31 avatar Jul 29 '22 09:07 sbernard31

@Frendzel I have a cleaner abstraction than #1220 for server side at #1318 , if you try to implement a LwM2mServerEndpointsProvider based on MQTT pretty much like described in LWM2M-v1.2@transport§8.0.8-MQTT Transport Binding, let me known. :pray:

sbernard31 avatar Oct 06 '22 13:10 sbernard31

first version of transport layer abstraction is now in master, See https://github.com/eclipse/leshan/issues/1025#issuecomment-1373824399 for more details.

sbernard31 avatar Jan 10 '23 10:01 sbernard31