Skip to content

Commit fe45405

Browse files
authored
fix(connect/ws): ensure proxy stream is writable (#2024)
Here the proxy stream is being written, so we need to check if it is writable ("which means the stream has not been destroyed, errored, or ended, see https://nodejs.org/dist/v18.19.0/docs/api/stream.html#writablewritable ). Fixes #1914 I could reproduce the 'stream.push() after EOF' error in an app, but unfortunately have no idea how to use it for a reproduction. Hopefully this patch provides enough inspiration to write a test.
1 parent a6e74ad commit fe45405

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib/connect/ws.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ const browserStreamBuilder: StreamBuilder = (client, opts) => {
256256
* https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/message_event
257257
*/
258258
async function onMessage(event: MessageEvent) {
259-
if (!proxy || proxy.destroyed || !proxy.readable) {
259+
if (!proxy || !proxy.readable || !proxy.writable) {
260260
return
261261
}
262262
let { data } = event

0 commit comments

Comments
 (0)