Package 

Interface StreamSubscription


  • 
    public interface StreamSubscription
    
                        

    Handle returned by every Streamsubscribe(…) call.

    Holding a reference to this object keeps the underlying listener / flow active. Call cancel when you no longer need updates to:

    • stop receiving events,

    • free any related resources (coroutine, network socket, etc.),

    • avoid memory leaks.

    Instances are single-shot: once you invoke cancel the subscription is permanently terminated and calling cancel() again has no effect.

    • Method Summary

      Modifier and Type Method Description
      abstract Unit cancel() Terminates this subscription.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • cancel

         abstract Unit cancel()

        Terminates this subscription.

        After the call:

        • No further events will be delivered.

        • The implementation should release all resources associated with the subscription.

        The operation is idempotent; invoking it multiple times is safe.