Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
adriancable opened this issue Feb 16, 2022 · 0 comments

Comments

@adriancable
Copy link

adriancable commented Feb 16, 2022

  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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant