Oyatel / CometD.NET

CometD.NET is a C# client library for the Bayeux protocol
43 stars 34 forks source link

How to get notified when the client is reconnected? #22

Open codeowl1 opened 7 years ago

codeowl1 commented 7 years ago

Hi there,

I am writing an app where the server will periodically go offline and come back online, and I need the client to automatically reconnect, and when it does I need it to send some specific messages to re-initialize things.

I think the client is reconnecting automatically as the exceptions stop getting logged once I start the server again, however I can't find a way to get notified when the client reconnects (on the client side that is) and because of this there I have no way to trigger the sending of the specific messages I need to send when the client reconnects.

How can I solve this problem? There must be a way and I am just not seeing it.... like there must be an onConnected event?

Thanks for your time and contributions.

ohaucke commented 6 years ago

You could implement the IExtension interface and check the message in the rcvMeta method for the reconnect.