const wt = new WebTransport('https://echo.semantic-ui.com/echo');
await wt.ready;
const writer = wt.datagrams.writable.getWriter();
await writer.write(new TextEncoder().encode('hello'));
const reader = wt.datagrams.readable.getReader();
const { value } = await reader.read(); // "hello"
The specification replaced datagrams.writable with
createWritable() in 2025. Safari ships the current shape and Chrome still ships
the old attribute, so feature-detect the writer. readable is an accessor on
every engine.
import { WebTransport } from '@fails-components/webtransport';
const wt = new WebTransport('https://echo.semantic-ui.com/echo');
await wt.ready;
const writer = wt.datagrams.writable.getWriter();
await writer.write(new TextEncoder().encode('hello'));
Nothing in Node terminates or dials WebTransport without a native addon.
This package is the one with production use behind it.
var transport webtransport.Transport
_, session, err := transport.Dial(context.Background(), "https://echo.semantic-ui.com/echo", nil)
if err != nil {
log.Fatal(err)
}
session.SendDatagram([]byte("hello"))
echo, _ := session.ReceiveDatagram(context.Background())
fmt.Println(string(echo)) // hello
The Go client requires the peer to negotiate RESET_STREAM_AT, which no
browser does. It reaches the Go endpoints here but not :4438.
let config = ClientConfig::default();
let connection = Endpoint::client(config)?
.connect("https://echo.semantic-ui.com/echo")
.await?;
connection.send_datagram(b"hello")?;
let echo = connection.receive_datagram().await?;