Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[leshan-dev] Persist sessions to restore connections

Hi all,

I've been looking for a way to ensure that notifications sent by a client are continued to be received by the LWM2M server after the server restarts/crashes and reboots. 

I first unsuccessfully tried to persist connections, but that seemed unnecessarily complex.

After the recommendation from this issue: https://github.com/eclipse/leshan/issues/554, I tried to persist DTLSSessions using the sessionCache interface. For this I had to implement/adapt serializers for some classes. 

Luckily this works! When a client registers, the DTLSSession is persisted on sessionEstablished event. Then the server observes a resource and notifications are received. The server then stops and restarts. On restart the sessions are read and for each session a connection object is created and the inMemoryConnectionStore is populated.

The notifications thus continue to be received. 

All good, but I'm trying to understand why exactly this works and when would it not work. Since the session was saved when the client registered, there can be a significant time between saving a session and restoring it. 

My first guess is that since we're talking about UDP here, the server simply assumes that some packets were lost and just continues as though nothing happened. But this explanation seems to simple. 

Also, it appears that losing parts of the connection object (basically everything other than the session object) has no bearing whatsoever to the normal functioning of the server. 

Regards,



Back to the top