1

Hi my aim is to catch when the session is invalidated and send message to all destination that the FlexClient subscribed that the client wiht id .... has disconnected.

I implemented a service which listens for sessionCretaed,sessionDestroyed,clientCreated,clientDestroyed,messageClientCreated,messageClientDestroyed.

Problem is that i want to catch messageClientDestroyed and send to that destination a message that the user has disconnected.But blazeds destroys messageClient when you add a subtopic.So how to understand that if session is invalidated and all messageClient are being destroyed or the user just enter another place and add a subtopic to his consumer.

I'am also open for other solutions to implement that mechanism.When user disconnected by session timeout or closed the site browser etc. i wanna catch it and send a message to subscribed destinations.

thank you.

1 Answer 1

1

I am not a master on this topic but I believe you have to tune into the Flex session lifecycle event, FlexSessionListener after a d/c.

If your client is leaving because they want to, on the flex side you invoke disconnectAll() on the ChanelSet so that Blaze DS will clean up resources explicitly.

If your client is leaving because of timing out, you can configure the channel definition to use invalidate-session-on-disconnect = true

These two should trigger the FlexSessionListner.sessionDestroyed(). The parameter for this method is a FlexSession object where you can extrapolate what you need.

2
  • First of all thank you for your answer. At first i have implemented a service just as you said but since my aim is send a message to subscribed channels i need to get the subscribed destinations. But blazeds first destroys messageClients then FlexClients and finally destroys the session.So when i try to get FlexClient or messageClients in sessionDestroyed i got nothing. Now i am catching the messageClientDestroyed event to send message but it is not only called when session destroyed it is also called when client add a subtopic so i need to get if session is going to destroy or a stopic added. Jul 26, 2011 at 11:32
  • That is mighty weird, the FlexSession object passed into sessionDestoryed should give the client that is leaving. If you can get access to the MessageService instance, you could invoke pushMessageToClients() .... livedocs.adobe.com/blazeds/1/javadoc/flex/messaging/services/… Jul 26, 2011 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.