Repository navigation
v0.1.12
Lets a grpcws server close the WebSocket when its stream ends, and drop
clients that stop reading. massrelay needs both to evict slow consumers
(issue 47). It also fixes a server connection that outlived a clean client
close by up to the pong timeout, and a TS client bundle that imported nothing
(issue 46). The new options all default to off.
Added
grpcws.ConnOptions, embedded in all three stream handlers:
CloseOnStreamEndsends a 1000 close frame afterstream_endand ends the
connection,CloseGracePeriod(default 2s) bounds how long a stuck client
can hold the socket after that, andWriteTimeoutsets a per-write
deadline (PR 48).http.BaseConn.WriteTimeoutandhttp.BaseConn.CloseAfterSend, plus a
Closevariant onOutgoingMessage(PR 48).- TS client:
GRPCWSClientandTypedGRPCWSClientreportstreamEndedin
onClose, so an app can tell a normal end from a dropped connection. The
mock gainssimulateStreamEnd()andsimulateClose(code, reason)(PR 48).
Changed
- TS client:
onClosereceivesCloseInfo(code,reason,wasClean).
Existing() => {}handlers still type-check, but code that calls
onClose()directly needs an argument (PR 48). - A failed write on
BaseConnnow closes the socket. Before, the Writer
stopped but the read loop kept a connection open that could no longer send
(PR 48). - Any close or read error now ends
WSHandleConn, even whenOnError
returns nil. The reader has already stopped by then, so carrying on only
meant waiting for the pong timeout (PR 48).
Fixed
WSHandleConnnow ends when the client closes cleanly (code 1000) or the
server closes the socket. Both surfaced asnet.ErrClosed, which
conc.Readerreports only onClosedChan, so the loop waited for the pong
timeout (PR 48).- TS client: a browser bundle of
@panyam/servicekit-clientimported nothing.
Thebrowserfield named the IIFE script build, which has no exports, and
esbuild prefers that field overmodulefor a browser, so every named
import wasundefined. The package now has anexportsmap whose
import,browseranddefaultconditions namedist/index.mjsand whose
requirenamesdist/index.js. The script build moved to theunpkgand
jsdelivrfields, and./dist/*and./package.jsonstay reachable by
path. CI now builds the client before its tests (issue 46, PR 49).