langhuihui / webtransport-go Goto Github PK
View Code? Open in Web Editor NEWWebTransport Server based on quic-go
WebTransport Server based on quic-go
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!
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.
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>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.