Results 1 to 2 of 2
  1. #1
    Senior Member
    Join Date
    Jul 2013
    Posts
    39

    About connect and sendMessage

    Hi,

    I have several questions:

    1. When is safe-time to make first call for "sendMessage" and "subscribe" after invoke LSclient.connect()?
    a. Can I call such functions right after the call LSclient.connect()?
    b. Or should I wait for LSclient.getStatus()=="CONNECTED"?

    2. What is best practice for recovery when sendMessage got error?

    Thanks

  2. #2
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    539
    Hi tvhnet2013,

    1. Since a message is handled by the Metadata Adapter associated to the current connection, a message can be sent only if a connection is currently active.
    More precisely, it is possible to send a message if the current status is not "DISCONNECTED*". Moreover, as soon as the status switches again to "DISCONNECTED*", any message still pending is abandoned and the ClientMessageListener.onAbort event is fired.

    So, you can call the sendMessage soon after the LightstreamerClient.connect but in this case you should arrange the appropriate recovery actions in case of failure (retry sending the message).
    Please refer here for further details on the sendmessage lifecycle.


    2. First you have to implement a ClientMessageListener and differentiate the behavior of your code based on the type of event to handle.

    Handling is dependent upon your application context and the type of reject you have received, in particular if you can or not be sure that your Adapter has received the message or if the error is originated from the Adapter own.

 

 

Bookmarks

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 03:03 AM.