WebTransport

웹트랜스포트

An HTTP/3 session carries multiple streams and datagrams for bidirectional data.

···
html
<div class="n-demo"><div class="n-head"><strong>WEBTRANSPORT SESSION</strong><span>LIVE TRACE</span></div><div class="n-stage"><div class="wt"><div class="wt-lane"><span>BIDI</span><i id="wt0"></i><b>⇄</b></div><div class="wt-lane"><span>UNI</span><i id="wt1"></i><b>→</b></div><div class="wt-lane"><span>DGRAM</span><i id="wt2"></i><b>→</b></div></div></div><div class="n-foot">tap to step · auto replay</div></div>
css
.n-demo{width:min(94vw,760px);height:min(88vh,324px);padding:clamp(9px,2.2vmin,18px);border:1px solid var(--line);border-radius:13px;background:var(--surface);display:flex;flex-direction:column;gap:clamp(5px,1.3vmin,10px);font:600 clamp(12px,2.4vmin,16px)/1.3 "Pretendard Variable",Pretendard,-apple-system,BlinkMacSystemFont,"Apple SD Gothic Neo",sans-serif;overflow:hidden}.n-head,.n-foot{display:flex;justify-content:space-between;align-items:center;color:var(--muted)}.n-head strong{color:var(--accent)}.n-head span,.n-foot{font-size:12px}.n-stage{flex:1;min-height:0;position:relative;display:flex;align-items:center;justify-content:center;gap:clamp(4px,1vmin,10px)}.mono{font-family:ui-monospace,SFMono-Regular,Consolas,monospace}.n-box{padding:clamp(5px,1.5vmin,11px);border:1px solid var(--line);border-radius:8px;background:var(--bg);text-align:center}.n-on{border-color:var(--accent)!important;color:var(--accent)!important;background:color-mix(in srgb,var(--accent) 12%,var(--surface))!important}.n-muted{color:var(--muted)}@media(max-width:400px){.n-head span{display:none}}.wt{width:94%;padding:8px;border:1px dashed var(--accent);border-radius:9px;display:grid;gap:7px}.wt-lane{display:flex;align-items:center;gap:6px}.wt-lane span{width:50px;font-size:12px}.wt-lane i{height:14px;width:8%;border-radius:3px;background:var(--accent);transition:width .5s}.wt-lane:nth-child(2) i{background:var(--accent-2)}.wt-lane:nth-child(3) i{background:var(--accent-3)}.wt-lane b{font-size:16px}
js
let step=0;function advance(){const widths=[[22,9,13],[43,31,55],[66,67,20],[91,83,79]];widths[step].forEach((v,i)=>document.getElementById('wt'+i).style.width=v+'%');step=(step+1)%4}
const clickTarget=document.querySelector('.n-demo');if(clickTarget&&typeof advance==='function'){advance();const timer=setInterval(advance,1050);clickTarget.addEventListener('pointerdown',()=>{clearInterval(timer);advance()})}

WebTransport is a browser API for bidirectional streams, unidirectional streams, and datagrams in one session. Streams suit reliable ordered data; datagrams suit updates where some loss is acceptable.

The demo animates three lanes with different directions and progress. It requires browser and server support in a secure context.

When to use

Consider it when a real-time app needs different reliability modes within one connection.

Open as page ↗