Skip to content

Writes (both server->client and client->server) from unidirectional/bidirectional streams do not work #3

@adriancable

Description

@adriancable
  1. Use https://googlechrome.github.io/samples/webtransport/client.html
  2. Connect to your example server
  3. Enter 'XYZ123' in the 'Send data over WebTransport box', then press 'Open a bidirectional stream'

I expect to see: 'XYZ123' received by the server, and then echoed back to the client (via the s.Write(buf[:n]) line in your example)

What actually happens: the server receives nonsense

receive from Stream:40 41 00

and this is then echoed back to the client (which does successfully receive the same 'nonsense' string of 40 41 00). So the 'write' part is working OK, it is just the 'read' part which is broken.

Edited to add: note that if (instead of langhuihui/WebTransport-Go) I use Google's python3 demo server (https://raw.githubusercontent.com/GoogleChrome/samples/gh-pages/webtransport/webtransport_server.py), everything works fine.

Edit 2: here is the skeleton client I use to test things - this gives the same "nonsense" result as reported above:

<html>
<script>
  async function main() {
    let transport = new WebTransport("https://xxxxxx:4433/counter");
    await transport.ready;
    let stream = await transport.createBidirectionalStream();
    let encoder = new TextEncoder();
    let writer = stream.writable.getWriter();
    await writer.write(encoder.encode("XYZ123"));
    writer.close();
    console.log(await new Response(stream.readable).text());
  }

  main();
</script>
</html>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions