Home

lastEventId

LastEventId, often shown as lastEventId in code, is the identifier of the most recently received event in streaming HTTP protocols such as Server-Sent Events (SSE). Each event can include an id field. The lastEventId value is updated whenever a new event with an id is received, and it is commonly used to resume a stream after a disconnection.

During the SSE handshake, when the client reconnects after a break, the client may send an HTTP

The EventSource API in web browsers exposes a lastEventId property that reflects the last event ID seen

Considerations: While lastEventId helps with deduplication and resuming streams, it does not guarantee delivery or exact

See also: Server-Sent Events, EventSource, id field in SSE, Last-Event-ID header.

header
named
Last-Event-ID
containing
the
value
of
the
lastEventId.
This
allows
the
server
to
identify
where
the
client
left
off
and
to
optionally
resend
events
that
followed
that
ID.
The
server's
behavior,
including
whether
to
replay
events,
depends
on
its
implementation.
by
the
client.
As
events
arrive
with
an
id:
line,
lastEventId
is
updated
accordingly.
replay
semantics
across
all
servers.
Applications
should
design
their
event
streams
with
id
monotonicity,
handle
duplicates,
and
implement
application-level
deduplication
if
necessary.
The
Last-Event-ID
header
is
optional
and
may
be
ignored
by
servers
that
do
not
support
resuming.