ReadAll() Implementation for bidirectional stream
moksh-samespace opened this issue · 2 comments
moksh-samespace commented
Quic-go support ReadAll() for bidirectional stream. Is there any way to achieve this in webtransport-go?
marten-seemann commented
That's standard library functionality.
moksh-samespace commented
Can you help with an example how I can achieve this
Current Implementation:
`
stream, err := conn.AcceptStream(conn.Context())
if err != nil {
fmt.Println("Session closed, not accepting more bidi streams:", err)
break
}
for {
buf := make([]byte, 1024)
n, err := stream.Read(buf)
if err != nil {
fmt.Printf("Error reading from bidi stream %v\n", err)
break
}
}
`
Required:
buf, err := stream.ReadAll()