Closed achingbrain closed 8 months ago
io.Copy
doesn't close the stream (it takes an io.Writer
, not an io.WriteCloser
). You'll have to manually close the stream once io.Copy
has returned.
Ah, thanks for taking a look. It all starts to work if the stream is explicitly closed by the server.
Here is a repro: https://github.com/achingbrain/go-webtransport-readable-never-ends largely based on interop/main.go from this repo.
The details are in the readme, but running
npm start
starts awebtransport-go
server that listens on a port, accepts incoming WebTransport sessions, waits for an incoming bidirectional stream to be opened and pipes the stream back to itself.Some JavaScript is printed out that you can paste into https://codepen.io/pen/?editors=0012 and see it run.
It connects to the
webtransport-go
server, opens a bidirectional stream, writes a single message into the stream and closes the writable, then reads from the readable until it closes.The output is:
After the final
"CLIENT read from stream"
, the readable is read from again and it should return{ done: true }
to signal it's ending but no further data is received.The server end seems to see the stream finish so perhaps the
FIN
isn't being sent?