Home

OnNext

OnNext is a term used in reactive programming to deliver the next element in a data stream to an observer. In the .NET Reactive Extensions, OnNext is a method of the IObserver<T> interface.

Role in the contract: An IObservable<T> sequence pushes data to observers by calling OnNext for each item.

Usage constraints: The producer should not call OnNext after OnCompleted or OnError. In many implementations, OnNext

Signature and variants: In .NET, OnNext has the signature void OnNext(T value). In other ecosystems there is

Examples and semantics: An observer implementing OnNext might update a UI, accumulate values, or forward them

Related concepts: OnError and OnCompleted; backpressure considerations differ between Rx implementations (for example, RxJava provides Flowable

---

The
sequence
is
terminated
by
either
OnCompleted
or
OnError.
OnNext
may
be
called
multiple
times,
and
is
the
main
channel
for
data
items.
should
not
throw
exceptions;
if
it
does,
the
sequence
is
typically
terminated
with
an
error.
a
similar
method
with
different
casing,
such
as
onNext
in
RxJava.
to
downstream
operators.
Operators
in
Rx
compose
around
OnNext
to
transform,
filter,
or
combine
streams.
with
backpressure
support).
OnNext
is
central
to
the
push-based
model
of
reactive
streams.