Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2006

    Forcing subscription termination

    Since Lightstreamer Server 7.1 the Java In-Process Adapter SDK (SDK version 7.2.0) features the possibility to forcibly interrupt a client subscription from the Metadata Adapter.
    This may be needed, for instance, when the authorization granted to a client for a subscription request is meant to be limited in time.
    In practice, from Metadata Adapter code, after authorizing a subscription request from the notifyNewTables callback, you can keep the TableInfo object received; then, later, you can invoke forceUnsubscription on this object to close the subscription.
    This behaves as though the unsubscription was requested by the client. The client is also notified of the unsubscription as though it had been requested by itself.

    The following snippet of Metadata Adapter code exemplifies how you can enforce termination for a subscription that, for instance, has lasted for more than five minutes.

    Note that implementing notifyNewTables to accept the subscription is a necessary preconditions. Hence implementing wantsTablesNotification and returning true is also necessary.

    Also note that subscriptions are performed in "tables", i.e. groups of items for which the same field schema is specified.
    As a consequence, enforced unsubscriptions are also performed on such tables as a whole, exactly like client unsubscription requests.
    If enforced unsubscriptions with the scope of single items are needed in your application, ensure that the client subscribes to such items singularly (and check in notifyNewTables that this condition is met, by refusing any attempt to do otherwise).

    As for the Remote Adapter SDKs, this feature has been ported to the Java Remote and Generic Adapter SDKs, but this requires Server version 7.3 or later; it has not been ported to the other Remote Adapter SDKs yet.

  2. #2
    Join Date
    Jul 2006
    For now, a workaround that a Remote Metadata Adapter could adopt to achieve the same is to connect back to Lightstreamer Server from the client interface.
    In practice, the Remote Metadata Adapter will handle the equivalent of the notifyNewTables method for its SDK in a way similar to that shown above.
    Then, it should connect to the instance of Lightstreamer Server related to it and send the unsubscription request on behalf of the client. The sessionId of the involved session, along with the subscription's "win index" are sent as parameters. SessionIds are random and complex enough to be quite impossible to guess, so no specific authentication is required to send such request.
    The "win index", i.e. the subscription's unique identifier within the session, is provided to the Remote Metadata Adapter in the equivalent of the TableInfo object for its SDK.

    The protocol to use to express the termination request should match the protocol currently used by the client for the underlying session; but actually there is no such costraint and any supported protocol can be used.
    This allows us to use the simplest protocol available, which is the old text protocol (i.e. the SDK for Generic Clients up to build 1803, before the introduction of the TLCP protocol).
    An unsubscription request can be expressed in the old text protocol as a simple HTTP request with a URL of this form:
    /lightstreamer/control.txt?LS_session=<the session id>&LS_op=delete&LS_table=<the win index>
    The reference for the syntax is available here (see paragraph 4.3.1).

    This protocol can be used always with Server 7.1. With 7.0 it may not be available for Enterprise licenses which only include the Web and/or Node.js SDKs. With earlier versions, it is available only for Presto and Vivace editions.
    For all other cases, you can resort to the old internal javascript protocol. There is no reference for this protocol, but the request syntax is very similar. An unsubscription request can be expressed in this form:
    /lightstreamer/control.js?LS_session=<the session id>&LS_op=delete&LS_table=<the win index>



Similar Threads

  1. Forcing session termination
    By Alessandro in forum General
    Replies: 6
    Last Post: February 7th, 2020, 03:03 PM
  2. Forcing session termination
    By DarioCrivelli in forum General
    Replies: 0
    Last Post: February 7th, 2020, 02:39 PM
  3. Replies: 3
    Last Post: August 7th, 2013, 10:00 AM
  4. Security patterns: Forcing disconnection
    By churrusco in forum General
    Replies: 15
    Last Post: April 20th, 2010, 09:46 AM
  5. Replies: 6
    Last Post: May 30th, 2007, 12:47 PM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT +1. The time now is 08:49 PM.