Repository navigation
4.22.2
This release fixes bugs in how the client, its managers and the socket wrappers move between states: what they do
when a connection drops, closes or switches while something else is under way.
Fixed
reconnect()afterclose()takes back the hold ofconnect(): a client started withconnect()stays connected
again untilclose(), even with no hook holding it. It used to close the new connection 5 seconds after it
opened.- A client closed, or one that gave up, in the few seconds after a connection nobody held opened (such as one a
Suspense render started) stayscloseduntil the next hook holds it. It used to turnidlewhen those seconds
ran out, and readingreadythen connected it again afterclose(). - A request made while the socket isn't open, on a client created with
queue: false(orqueue.limit0), rejects
right away and sends nothing, like a volatile one. It used to wait for its timeout, forever with
timeout: Infinity, and then send a cancel for an id the server never got. - A request that starts a client which fails at once, such as one with an invalid URL, rejects as on a closed
client instead of waiting in the queue. A request made afterdispose()rejects instead of going out with nothing
listening for its reply. - A
timeoutlonger thansetTimeoutcan wait, about 24.8 days, waits forever in requests and in the responder.
It used to time out at once. - The responder answers a request only on the connection it arrived on. During a
migrate()switch, a reply, or a
request that an asyncschemadelivered late, could reach the new connection, where the server doesn't know the
id. - A topic acquired on a socket that had just opened, from a store listener or an earlier
openlistener, is
subscribed once, not twice. - When the connection drops, only the runs that were streaming on it are aborted. A run that a listener started
meanwhile, such as the next prompt in a queue, was aborted with them, so a queue drained itself. - A run that a listener ends as soon as it starts no longer sends a resume and holds the connection for good.
- Presence forgets the other peers when the client closes, so
close()on logout doesn't leave the previous user's
peers on screen until they time out. It refreshes only after a send that went out, so no timer runs while
disconnected, andset()afterdispose()no longer starts a refresh that never stops. - Latency doesn't start its ping interval when an earlier
openlistener already closed the connection. - The outbox sends each entry once per connection. An
add()from anopenlistener that ran before the outbox's
own used to send everything again. An entry removed, sent or replaced during a flush, for example byonExpire,
is no longer sent or brought back by it.remove()andclear()afterdispose()delete from storage instead of
throwing. - AG-UI: a chunk without a
messageIdcontinues its message past the activity events between chunks, instead of
going to the activity message. An aborted run shows no step, and a new run doesn't start with the last one's
step, error or result. A run followed again after a reload shows as running until its events replay, and as
aborted if it was stopped meanwhile. - After a reconnect, the timeline doesn't take latency measured on the previous connection as the server's clock,
which pinnedrenderTime()to a restarted server's old clock. react-websocket/webtransport: a fallbackWebSocketthat throws, for example on protocols it rejects, or a
Blobthat can't be read, fails the connection with anerrorand a1006close. It used to leave the socket
connecting forever, or drop every later send. A session that fails no longer leaves an unhandled promise
rejection, which error trackers reported on every fallback.react-websocket/chaos:close()with a reason over 123 bytes throwsSyntaxError, like a browser, where it used
to leave the socket closing for good. A stall also holds back the sends still delayed bylatency. With
latency, a page in a background tab no longer falls behind until its heartbeat gives up: browsers hold its timers
back by a second to a minute, solatencynow pauses while the tab is hidden.react-websocket/replay: the recorder'sclose()with a code the browser rejects throws and leaves it open, where
it used to leave it closing and ignoring its messages. A replay'sdoneresolves after the lastcloseevent,
not before it.react-websocket/tabs: the shared connection closes once its last socket does, even after a tab's socket closed
while its connect was on the way. Thepagehidelistener is removed once no socket is open, and a tab disposed
while waiting to lead no longer throws when it takes over.