Mechanism for removing connection onClose
callback
#229
Labels
1.0
Pullrequests & issues related to the Typescript rewrite and 1.0 release
enhancement
Suggests, requests, or implements a feature or enhancement
We can register a callback with an
RSocket
using theonClose
method. We do not currently have any way to deregister a previously registered callback.Motivation
I'm sure there are other use cases, however, this would be useful when paired with the
useEffect
hook in React, which expect to be able to "undo" registrations and side-effects.Desired solution
RSocket
, likely throughCloseable
, could be extended to allow deregistration of callbacks. This might be best with havingCloseable
more closely resemble event emitter APIs.Considered alternatives
Rsocket.onClose
could implement/expose an observable that would natively support subscriptions. This could use existing types such asCancellable
andOnTerminalSubscriber
.The text was updated successfully, but these errors were encountered: