Skip to content
Simon edited this page Jan 20, 2022 · 20 revisions

What is Leshan and how should I use it ?

Eclipse Leshan™ is an OMA Lightweight M2M server and client Java implementation.

This is a not standalone server and client but a set of java libraries which help people to develop their own Lightweight M2M server and client. So to use Leshan, you need to write java code!

Could I reuse leshan-*-demo ?

Leshan demos are a good way to explore LWM2M or quickly test interoperability but this should not be reused for production. These are just demos. There is no effort about scalability and they could be completely modify between 2 releases. However you could look at the code as an example of the Leshan API.

(It's still not clear see this discussion)
(Some reasons to no use demo in a product)

Is there a REST API for leshan-*server-demo ?

Yes, there is, but as explained above we don't encourage you to use it. This API is just here to be used by our Web UI demos. We can change it at any moment even for minor or bugfix release.

If you still want to use it, it is available at http://yourhost:8080/api/*.

E.g. :

To explore all the API, the easy way is to use web development tools of your browser(like firefox) and see REST request sent when using the leshan-*-demo web UI.

How to activate more log ?

Leshan libraries are using SLF4J as logging facade, meaning that you can use any compatible backend for your application.

Our demos are using logback backend.
Since 2.0.0-M5 a verbosity option(-v, -vv , ...) allow to change log level.
To activate more logs for those demos, look at this or read logback documentation.

Old Client demo (before 2.0.0-M5) is using simple logger backend.

How to add new objects ?

See Adding-new-objects.

How request timeout works ?

See Request-Timeout.

What happen after a reboot of Leshan Server ?

See Server Failover.

All questions relative to LWM2M observe.

See LWM2M observe.

My devices IP address/port change, How can I handle it ?

See LWM2M-Devices-with-Dynamic-IP

Could I configure the awake time of a device (Queue mode) ?

Meaning the time during Leshan server consider the device present when using queue mode.
The default value is 93000ms but you could change this value :

builder.setClientAwakeTimeProvider(new StaticClientAwakeTimeProvider(60000));

This is out of the spec but you could see how to have a dynamic per client awake time here.

Using Leshan Server in a Cluster ?

See Using-Leshan-server-in-a-cluster.

Can I use Leshan with Android ?

Developers team never tested it.
But we activate animal-sniffer-maven-plugin for ensure we don't use class which are not present in android, so we should be compliant with Android 4.4.2 (API level 19).
We also know there are some project/demo which are using leshan with android : leshan-android-demo, LwM2MDemoClientAndroid.

(see #573 for more details)

Will Leshan support LWM2M 1.1 ?

See https://github.com/eclipse/leshan/issues/563.

What is the difference between MQTT and LWM2M ?

  1. LWM2M and MQTT are not really at same level. This would be more relevant to compare CoAP and MQTT. MQTT is just a communication protocol and does not define data meaning. LWM2M talk about device, location, firmware update, bootstrap devices ... This makes probably MQTT more flexible but less interoperable than LWM2M. LWM2M 1.1 bring LWM2M over CoAP+tcp and LWM2M 1.2 bring it over MQTT and HTTP.

  2. LWM2M is mainly designed for device management but you could use it for application management. MQTT is just a publish/subscribe protocol.

  3. In LWM2M 1.0, only CoAP is supported. This means LWM2M run over UDP(DTLS) and MQTT over TCP(TLS). But with LWM2M 1.1/1.2 there is TCP(TLS) support too with CoAP+tcp, MQTT and HTTP as LWM2M transport layer. (There is ever Non-IP transport layer)

  4. Theorically using CoAP over UDP should make LWM2M more adapted to constraint environment. In real world, IF(only if) you begin to use all the available features (CoAP observe/CoAP blockwise transfer/ DTLS role exchange ...), this is maybe not so true.

  5. In LWM2M 1.0, requests are mainly sent by the server. Server send READ, WRITE. If you need to send data from device to server, this is no so adapted. You can eventually fiddle with OBSERVE but this is not so good. LWM2M 1.1 fix this "issue" by adding the SEND request (from device to server).

(Some additional resources : Comparison and Evaluation of LwM2M and MQTT in Low-Power Wide-Area Networks.pdf by Alessandro Parmigiani)

How using Leshan to download firmware package ?

Look a Using CoAP Block Wise to transfer large file ? wiki page.