Lightstreaemer Server 3.6 release is now available.
What follows is a sample code for forcing session termination from the Metadata Adapter, made possible by the new "destroy session" request.
The sample can substitute the JMX based one shown earlier in this thread and represents a new implementation of Option 1 introduced above.

So, we show a code snippet that, added to the Metadata Adapter code, listens to the notifications for session initiation and termination and causes each session to be closed after it has lived longer than five minutes.
Upon forced session closure, the Web Client Library will enter "DISCONNECTED" state and won't try to recover the session; it will just notify application code through the "onServerError" event handler, with proper error codes.



Note that the above code can only be used in Lightstreamer "Presto" or "Vivace" edition, in which the text interface is available.
In "Allegro" or "Moderato" edition, we need to resort to the html or javascript interface; the following code snippet exploits the javascript case; the request syntax is the same, but for control.js in place of control.txt.




Note that the response is in javascript and it is more complicated to analyze it.
In case the operation is successful we should expect:

On the other hand, if the session was not found we should expect:

Any other response means that an unexpected condition has occurred.