Lightstreamer Server v.7.4.0 introduced official support for request-responde interactions based on the sendMessage facility. Please see this announcement for more information.


Lightstreamer originated for asynchronous pub/sub based interaction. But there are cases where using Lightstreamer also for traditional synchronous request/response interaction would be handy. Out-of-the-box support for request/response (aka RPC) will be offered in a future version of Lightstreamer. In the meantime, there are two different ways to easily achieve request/response in Lightstreamer.

Let's see both the solutions through an example.
The request is an integer number and the answer will be the sum of that number with the username (the username is a number too). Most of the error handling is obviously missing to keep the code as small as possible.


A disposable subscription is used. It will carry the request in the item name and the answer in its only update (snapshot). Once the response is received, the subscription will be unsubscribed.

JS Client:

Server (Java Metadata Adapter):

Server (Java Data Adapter):


This is a trick that exploits the capability of the sendMessage call to receive error messages from the Metadata Adapter. This solution can only be used if the notifyUserMessage method in the Metadata Adapter can actually execute fast.

JS Client:

Server (Java Metadata Adapter)