-
October 24th, 2013, 06:08 AM
#1
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
-
October 25th, 2013, 08:53 AM
#2
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 04:33 AM.
Bookmarks