Giter VIP home page Giter VIP logo

webtransport-go's People

Contributors

langhuihui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

webtransport-go's Issues

Received datagrams have zero byte added to front?

Hi - I am using your example code (basically unchanged) together with https://googlechrome.github.io/samples/webtransport/client.html to connect and send a datagram. It works, but every message received by the server has a zero byte prefixed. For example, if I send a 5-byte datagram from the browser end ('HELLO'), the client apparently receives 6 bytes and your log prints:

ReceiveMessage:00 48 45 4c 4c 4f

Can you explain why this is happening? Thank you!

No method to stop the WebTransport server?

Hi - after starting the server by calling Run(), it appears there's no clean way to stop it, short of stopping the whole process. Can you add a Stop() method so we can cleanly stop a server and/or allow the object returned by NewWebTransportServer to be garbage collected?

My specific application here is the need to periodically change the PEM/KEY of the service while it's running.

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

  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>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.