on
Returns a Flow of events of type T.
This is the preferred way to consume events in reactive environments (like Android). The flow will:
Filter events by the specified type T.
Remain active during reconnection attempts.
Complete normally when the client stateFlow is MsmpState.Closed, which means server stopped, or you closed the client, thanks to internal stateFlow tracking.
Subscribes to events of type T.
Lifecycle Behavior:
This listener is strictly bound to the MsmpClient lifecycle.
If the connection unexpectedly lost but auto reconnect is true, the collector remains active and will resume receiving events once reconnected.
Note for Android/Lifecycle-sensitive environments:
This method uses the client's internal scope. If you need the listener to be canceled when a UI component is destroyed, use the Flow-returning variant instead and collect it within your preferred scope.