Lightstreamer .Net Client 2.1.2
LSClient.SendMessage Method (MessageInfo, ISendMessageListener)

Sends a message to Lightstreamer Server. The message is associated to the current session and is interpreted and managed by the Metadata Adapter related to the session.  

Upon subsequent calls to the method, the sequential management of the messages is guaranteed. However, any message that, for any reason, doesn't reach the Server can be discarded by the Server if this causes the subsequent message to be kept waiting for longer than a configurable timeout. A shorter timeout can be associated with the subsequent message itself. A sequence identifier must also be associated with the messages; the sequential management is restricted to all subsets of messages with the same sequence identifier associated. In case the sequential management is undesired the special UNORDERED_MESSAGES sequence identifier can be used.  

Note that messages are sent to the Server asynchronously with respect to the Client thread and that the real outcome of the request should be obtained by listening for calls on the associated ISendMessageListener instance. Unless the return value is 0, one of those events will be eventually sent. Calls associated with the same sequence are guaranteed to be issued in sequence.  


public: int SendMessage(MessageInfo message, ISendMessageListener listener);
public virtual int SendMessage(MessageInfo message, ISendMessageListener listener);
Visual Basic
Public virtual Function SendMessage(message As MessageInfo, listener As ISendMessageListener) As Integer
MessageInfo message 
An instance containing the message string to be interpreted by the Metadata Adapter, the sequence this message has to be associated with and a delay timeout to be waited by the server for missing previous messages to be received before being declared lost. 
ISendMessageListener listener 
A listener instance to receive a call representing the outcome of the message request. 

0 if no session is open; in the other case a number representing the progressive number of the message within its sequence is returned (starting from 1). Note that each time a new session is established the progressive number is reset. Note that if no session is open, no attempt of sending the message will be performed; however, as messages outcomes are received from the Server asynchronously, if a session is open but ends before the message outcome is received, than a call to ISendMessageListener.OnAbort will be made.