ecorm / cppwamp

C++ client library for the WAMP protocol.
Boost Software License 1.0
35 stars 9 forks source link

Automatic reconnection #79

Open ecorm opened 9 years ago

ecorm commented 9 years ago

Provide automatic reconnection facilities. If a connection is dropped unexpectedly, CppWAMP would re-establish the session using the list of connector objects. It should also re-register RPCs and re-subscribe to events.

michaelaeriksen commented 8 years ago

Any updates on this? Any pointers to where to implement the fix?

ecorm commented 8 years ago

Like I said for your other comment: Sorry, I haven't yet put any thought in how I'd implement this. It's not an urgent feature for my project because Crossbar is hosted on the same device as my C++ program.

ecorm commented 2 years ago

Session state change callbacks (#78) are now implemented in 637589de4c8d36eab0120c3ad8ec458455e60e26. This should allow the user to implement their own reconnection logic.

I'm not sure yet what would be a sensible policy for an automatic reconnection feature provided by CppWAMP. Things to consider:

Another thing to consider is that Registration and Subscription objects become invalidated when a new session is established.

The current design with internal::Client objects being created for every Session connection operation admittedly makes things complicated. The rationale was to avoid virtual function calls when using the TCodec bound to the Client instance. In hindsight, the resulting complexity is not worth the potential performance gains, which I never even measured.

I'm therefore placing this feature on the back burner considering that the user now has a means to react to session disconnection/failure events. I'll take a look at it again if I get the chance to refactor the current design to favor runtime polymorphism over compile-time (i.e. template) polymorphism.

I'll take this opportunity to make a note to myself to keep an eye on the proposed Session Resumption WAMP protocol feature.