{"_id":"@moq/web-transport","_rev":"7-b72d98d55d2c2ad96d2e695431633fda","name":"@moq/web-transport","dist-tags":{"latest":"0.1.4"},"versions":{"0.0.1":{"name":"@moq/web-transport","version":"0.0.1","keywords":["webtransport","quic","http3","polyfill","napi"],"license":"(MIT OR Apache-2.0)","_id":"@moq/web-transport@0.0.1","maintainers":[{"name":"kixelated","email":"kixelated@gmail.com"}],"homepage":"https://github.com/moq-dev/web-transport#readme","bugs":{"url":"https://github.com/moq-dev/web-transport/issues"},"dist":{"shasum":"f3b01e2cf42baea2483e9c024e49cb481019c0e9","tarball":"https://registry.npmjs.org/@moq/web-transport/-/web-transport-0.0.1.tgz","fileCount":6,"integrity":"sha512-uBXiPaPvh93qmq+mJLskyTfu6eshJtwdMH6XdYlkhtiu4RYaUv1vaUAI2ditUsuQAUIc97BU+yIDD9sEh2+mlA==","signatures":[{"sig":"MEQCIDQLwmTakUL6hyvswI10RnL7lvD+JjlcK0UktiTq03oPAiA2fd69J2SbBLczUD9X7yuQL3TGSv/X0Yl4QOfuVbLXKg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":37935},"napi":{"targets":["x86_64-apple-darwin","aarch64-apple-darwin","x86_64-pc-windows-msvc","x86_64-unknown-linux-gnu","aarch64-unknown-linux-gnu"],"binaryName":"web-transport"},"type":"module","types":"./src/index.ts","exports":{".":"./src/index.ts"},"gitHead":"122a6c5324376088479301584d3b88cfb67351e0","scripts":{"build":"napi build --platform --release --manifest-path ../../rs/web-transport-node/Cargo.toml --output-dir .","check":"tsc --noEmit","release":"bun scripts/release.ts"},"_npmUser":{"name":"kixelated","email":"kixelated@gmail.com"},"repository":{"url":"git+https://github.com/moq-dev/web-transport.git","type":"git"},"_npmVersion":"10.9.2","description":"WebTransport polyfill for Node.js via QUIC/HTTP3","directories":{},"_nodeVersion":"22.17.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.2","@types/node":"^24.3.0","@napi-rs/cli":"^3"},"optionalDependencies":{"@moq/web-transport-darwin-x64":"0.0.1","@moq/web-transport-darwin-arm64":"0.0.1","@moq/web-transport-linux-x64-gnu":"0.0.1","@moq/web-transport-win32-x64-msvc":"0.0.1","@moq/web-transport-linux-arm64-gnu":"0.0.1"},"_npmOperationalInternal":{"tmp":"tmp/web-transport_0.0.1_1773790526807_0.4669473976823406","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"@moq/web-transport","version":"0.0.4","keywords":["webtransport","quic","http3","polyfill","napi"],"license":"(MIT OR Apache-2.0)","_id":"@moq/web-transport@0.0.4","maintainers":[{"name":"kixelated","email":"kixelated@gmail.com"}],"homepage":"https://github.com/moq-dev/web-transport#readme","bugs":{"url":"https://github.com/moq-dev/web-transport/issues"},"dist":{"shasum":"a348493dcac4fdabbd6e0dbbbbdd58fee3c4d7c4","tarball":"https://registry.npmjs.org/@moq/web-transport/-/web-transport-0.0.4.tgz","fileCount":11,"integrity":"sha512-vmDf3pCDlyWgWYOfzLWuOylPZW53vDQEwB1NnKnbmEGbCzFB9xN411zscl7WnvRlQRRfvFilDMggcRail28qZg==","signatures":[{"sig":"MEUCIQDhDJYO/0gcIFT3/gpOjx46WHThfp9ASrwLx/bqRjp6VgIgLp22m1M1p2pJHeoN7KBxTPYVlmAho4nHVwHbL6OQIWs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@moq%2fweb-transport@0.0.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":34949183},"napi":{"targets":["x86_64-apple-darwin","aarch64-apple-darwin","x86_64-pc-windows-msvc","x86_64-unknown-linux-gnu","aarch64-unknown-linux-gnu"],"binaryName":"web-transport"},"type":"module","types":"./src/index.ts","exports":{".":"./src/index.ts"},"gitHead":"152ca6e127b363f79c3c2871be31c3a170d4880d","scripts":{"build":"napi build --platform --release --manifest-path ../../rs/web-transport-node/Cargo.toml --output-dir .","check":"tsc --noEmit","release":"bun scripts/release.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:ac407a92-4133-400a-b4b1-dea4b2a7d7f9"}},"repository":{"url":"git+https://github.com/moq-dev/web-transport.git","type":"git"},"_npmVersion":"11.6.2","description":"WebTransport polyfill for Node.js via QUIC/HTTP3","directories":{},"_nodeVersion":"24.13.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.2","@types/node":"^24.3.0","@napi-rs/cli":"^3"},"optionalDependencies":{"@moq/web-transport-darwin-x64":"0.0.4","@moq/web-transport-darwin-arm64":"0.0.4","@moq/web-transport-linux-x64-gnu":"0.0.4","@moq/web-transport-win32-x64-msvc":"0.0.4","@moq/web-transport-linux-arm64-gnu":"0.0.4"},"_npmOperationalInternal":{"tmp":"tmp/web-transport_0.0.4_1773860220237_0.09370723997411945","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@moq/web-transport","version":"0.1.0","keywords":["webtransport","quic","http3","polyfill","napi"],"license":"(MIT OR Apache-2.0)","_id":"@moq/web-transport@0.1.0","maintainers":[{"name":"kixelated","email":"kixelated@gmail.com"}],"homepage":"https://github.com/moq-dev/web-transport#readme","bugs":{"url":"https://github.com/moq-dev/web-transport/issues"},"dist":{"shasum":"07b34befca3138cfe5a7462f4678d2e753a666f6","tarball":"https://registry.npmjs.org/@moq/web-transport/-/web-transport-0.1.0.tgz","fileCount":14,"integrity":"sha512-+swe5Y5DL67q5SU3xrbKYveBNU7U05X9GpYV0iX77JZAhSMUHqSpWGKuPuV97TxBKxNR7TMWJTwhw22p3YBY7Q==","signatures":[{"sig":"MEUCIQCuUCeYo/DJNedS2lk9Fn3Iz3QT24zwiIu7yJBHfWZHBQIgDEBHbF5Vr07+Owk481YpNmVJZqUt175xSrdJ2dsfMqs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@moq%2fweb-transport@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":35036233},"napi":{"targets":["x86_64-apple-darwin","aarch64-apple-darwin","x86_64-pc-windows-msvc","x86_64-unknown-linux-gnu","aarch64-unknown-linux-gnu"],"binaryName":"web-transport"},"type":"module","types":"./src/index.ts","exports":{".":"./src/index.ts"},"gitHead":"98f8ebb7464613fb9bcaedbed681e90888e7785b","scripts":{"build":"napi build --platform --release --manifest-path ../../rs/web-transport-node/Cargo.toml --output-dir . --js napi.js --dts napi.d.ts","check":"tsc --noEmit","release":"bun scripts/release.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:ac407a92-4133-400a-b4b1-dea4b2a7d7f9"}},"repository":{"url":"git+https://github.com/moq-dev/web-transport.git","type":"git"},"_npmVersion":"11.6.2","description":"WebTransport polyfill for Node.js via QUIC/HTTP3","directories":{},"_nodeVersion":"24.13.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.2","@types/node":"^24.3.0","@napi-rs/cli":"^3"},"optionalDependencies":{"@moq/web-transport-darwin-x64":"0.1.0","@moq/web-transport-darwin-arm64":"0.1.0","@moq/web-transport-linux-x64-gnu":"0.1.0","@moq/web-transport-win32-x64-msvc":"0.1.0","@moq/web-transport-linux-arm64-gnu":"0.1.0"},"_npmOperationalInternal":{"tmp":"tmp/web-transport_0.1.0_1775159418565_0.49801674155094844","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@moq/web-transport","version":"0.1.1","keywords":["webtransport","quic","http3","polyfill","napi"],"license":"(MIT OR Apache-2.0)","_id":"@moq/web-transport@0.1.1","maintainers":[{"name":"kixelated","email":"kixelated@gmail.com"}],"homepage":"https://github.com/moq-dev/web-transport#readme","bugs":{"url":"https://github.com/moq-dev/web-transport/issues"},"dist":{"shasum":"646cabfeced4fa4fc48ecd8c579c28189b8e2305","tarball":"https://registry.npmjs.org/@moq/web-transport/-/web-transport-0.1.1.tgz","fileCount":14,"integrity":"sha512-MnR6G74redbBDOxeqoqT8uCFQrqu3gj+KHxFVEPKGGNsNuVNWa9w+SU4FKSHrMK8sTPgaF1HDYYmfQY5Xp9djg==","signatures":[{"sig":"MEYCIQCK/mnyV/rqSpMlAGEGtC0adGXYyUOFRWi+cI8QPES87wIhALf1Qrlz5coFrVbo3z3Vd9QPZ+V1Y9tuHVhOSUqXsCKO","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@moq%2fweb-transport@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":35037495},"napi":{"targets":["x86_64-apple-darwin","aarch64-apple-darwin","x86_64-pc-windows-msvc","x86_64-unknown-linux-gnu","aarch64-unknown-linux-gnu"],"binaryName":"web-transport"},"type":"module","types":"./src/index.ts","exports":{".":"./src/index.ts"},"gitHead":"79a383cdb7f845f7a2fe4f6d1bf6e6581be8f995","scripts":{"build":"napi build --platform --release --manifest-path ../../rs/web-transport-node/Cargo.toml --output-dir . --js napi.js --dts napi.d.ts","check":"tsc --noEmit","release":"bun scripts/release.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:ac407a92-4133-400a-b4b1-dea4b2a7d7f9"}},"repository":{"url":"git+https://github.com/moq-dev/web-transport.git","type":"git"},"_npmVersion":"11.6.2","description":"WebTransport polyfill for Node.js via QUIC/HTTP3","directories":{},"_nodeVersion":"24.13.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.2","@types/node":"^24.3.0","@napi-rs/cli":"^3"},"optionalDependencies":{"@moq/web-transport-darwin-x64":"0.1.1","@moq/web-transport-darwin-arm64":"0.1.1","@moq/web-transport-linux-x64-gnu":"0.1.1","@moq/web-transport-win32-x64-msvc":"0.1.1","@moq/web-transport-linux-arm64-gnu":"0.1.1"},"_npmOperationalInternal":{"tmp":"tmp/web-transport_0.1.1_1775163729900_0.15701254328127123","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@moq/web-transport","version":"0.1.2","keywords":["webtransport","quic","http3","polyfill","napi"],"license":"(MIT OR Apache-2.0)","_id":"@moq/web-transport@0.1.2","maintainers":[{"name":"kixelated","email":"kixelated@gmail.com"}],"homepage":"https://github.com/moq-dev/web-transport#readme","bugs":{"url":"https://github.com/moq-dev/web-transport/issues"},"dist":{"shasum":"767967c37a4b35f4114d45db0fd8b1d8e9d70302","tarball":"https://registry.npmjs.org/@moq/web-transport/-/web-transport-0.1.2.tgz","fileCount":14,"integrity":"sha512-cJE0B+T5a8ey1ZgFUIBTWkIWfhCAYGAUgAw8XYeOPsKPjFhtW9M/C+XV8Yu0IeUS4nnrbBPw4sEc+TvMybV4IQ==","signatures":[{"sig":"MEUCIBIdMGBtmiV9GG5yrl4Tl0hmtCcqyldxxvtEl3893mrlAiEA/qCNOekG1Ju1urL5l55K1ERXSOUAsVOYSXpMWHb/1Wk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@moq%2fweb-transport@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":34968592},"napi":{"targets":["x86_64-apple-darwin","aarch64-apple-darwin","x86_64-pc-windows-msvc","x86_64-unknown-linux-gnu","aarch64-unknown-linux-gnu"],"binaryName":"web-transport"},"type":"module","types":"./src/index.ts","exports":{".":"./src/index.ts"},"gitHead":"df9d28a2fbf6d707a8fc00b917de3ec151ad2315","scripts":{"build":"napi build --platform --release --manifest-path ../../rs/web-transport-node/Cargo.toml --output-dir . --js napi.cjs --dts napi.d.cts","check":"tsc --noEmit","release":"bun scripts/release.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:ac407a92-4133-400a-b4b1-dea4b2a7d7f9"}},"repository":{"url":"git+https://github.com/moq-dev/web-transport.git","type":"git"},"_npmVersion":"11.6.2","description":"WebTransport polyfill for Node.js via QUIC/HTTP3","directories":{},"_nodeVersion":"24.13.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.2","@types/node":"^24.3.0","@napi-rs/cli":"^3"},"optionalDependencies":{"@moq/web-transport-darwin-x64":"0.1.2","@moq/web-transport-darwin-arm64":"0.1.2","@moq/web-transport-linux-x64-gnu":"0.1.2","@moq/web-transport-win32-x64-msvc":"0.1.2","@moq/web-transport-linux-arm64-gnu":"0.1.2"},"_npmOperationalInternal":{"tmp":"tmp/web-transport_0.1.2_1780172806690_0.5208698518904453","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@moq/web-transport","version":"0.1.3","keywords":["webtransport","quic","http3","polyfill","napi"],"license":"(MIT OR Apache-2.0)","_id":"@moq/web-transport@0.1.3","maintainers":[{"name":"kixelated","email":"kixelated@gmail.com"}],"homepage":"https://github.com/moq-dev/web-transport#readme","bugs":{"url":"https://github.com/moq-dev/web-transport/issues"},"dist":{"shasum":"46043471a3b607f41a16f23c7b89965d593762f4","tarball":"https://registry.npmjs.org/@moq/web-transport/-/web-transport-0.1.3.tgz","fileCount":14,"integrity":"sha512-hg3mKWUJaEwtJDGf8Ck62XP8ya+7wyMV/9ycV1A+M3iVly3xBOTPHpT8BrpOLomsBIB9iXQY6Z85MjknhUJW8w==","signatures":[{"sig":"MEUCIQCQjn4Sp37Yd7ZmlL8ns8OrjHkY4sQjPPO+JbKlAORi1gIgWyNFdjEfboGNOl7bZL2imx+h5VHp0yE2+qqJHqnvAZ0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@moq%2fweb-transport@0.1.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":35113496},"napi":{"targets":["x86_64-apple-darwin","aarch64-apple-darwin","x86_64-pc-windows-msvc","x86_64-unknown-linux-gnu","aarch64-unknown-linux-gnu"],"binaryName":"web-transport"},"type":"module","types":"./src/index.ts","exports":{".":"./src/index.ts"},"gitHead":"64cdee68e55cba4182215569f2320729a44afa19","scripts":{"build":"napi build --platform --release --manifest-path ../../rs/web-transport-node/Cargo.toml --output-dir . --js napi.cjs --dts napi.d.cts","check":"tsc --noEmit","release":"bun scripts/release.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:ac407a92-4133-400a-b4b1-dea4b2a7d7f9"}},"repository":{"url":"git+https://github.com/moq-dev/web-transport.git","type":"git"},"_npmVersion":"11.6.2","description":"WebTransport polyfill for Node.js via QUIC/HTTP3","directories":{},"_nodeVersion":"24.13.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.2","@types/node":"^24.3.0","@napi-rs/cli":"^3"},"optionalDependencies":{"@moq/web-transport-darwin-x64":"0.1.3","@moq/web-transport-darwin-arm64":"0.1.3","@moq/web-transport-linux-x64-gnu":"0.1.3","@moq/web-transport-win32-x64-msvc":"0.1.3","@moq/web-transport-linux-arm64-gnu":"0.1.3"},"_npmOperationalInternal":{"tmp":"tmp/web-transport_0.1.3_1782156855588_0.1622484227773433","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@moq/web-transport","version":"0.1.4","description":"WebTransport polyfill for Node.js via QUIC/HTTP3","type":"module","license":"(MIT OR Apache-2.0)","repository":{"type":"git","url":"git+https://github.com/moq-dev/web-transport.git"},"napi":{"binaryName":"web-transport","targets":["x86_64-apple-darwin","aarch64-apple-darwin","x86_64-pc-windows-msvc","x86_64-unknown-linux-gnu","aarch64-unknown-linux-gnu"]},"exports":{".":"./src/index.ts"},"types":"./src/index.ts","scripts":{"build":"napi build --platform --release --manifest-path ../../rs/web-transport-node/Cargo.toml --output-dir . --js napi.cjs --dts napi.d.cts","check":"tsc --noEmit","release":"bun scripts/release.ts"},"devDependencies":{"@napi-rs/cli":"^3","@types/node":"^26.1.0","typescript":"7.0.1-rc"},"optionalDependencies":{"@moq/web-transport-darwin-x64":"0.1.4","@moq/web-transport-darwin-arm64":"0.1.4","@moq/web-transport-win32-x64-msvc":"0.1.4","@moq/web-transport-linux-x64-gnu":"0.1.4","@moq/web-transport-linux-arm64-gnu":"0.1.4"},"keywords":["webtransport","quic","http3","polyfill","napi"],"gitHead":"6446afcb69d2d40e2c1e627af3e157f26dac9e76","_id":"@moq/web-transport@0.1.4","bugs":{"url":"https://github.com/moq-dev/web-transport/issues"},"homepage":"https://github.com/moq-dev/web-transport#readme","_nodeVersion":"24.13.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-VEKFEMRUSeQCZKlewvraBYWmqGcJY8IUp3gEKRqj6HkrEkDXBoN45D3925l1PJEjmOv8ZylJSx7dgGCnDCZDAQ==","shasum":"fd6d43ee56e2097dc0a7322f04d67e4776b9a210","tarball":"https://registry.npmjs.org/@moq/web-transport/-/web-transport-0.1.4.tgz","fileCount":14,"unpackedSize":36848370,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@moq%2fweb-transport@0.1.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEsQa/X3fc6UrjWEWgXFtFO4dQdPwdWUuGVxg5mC8VndAiBn4UM20B3MtK7dTy4UfViahw1QyidBjy+kW+Gpfx2HVg=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:ac407a92-4133-400a-b4b1-dea4b2a7d7f9"}},"directories":{},"maintainers":[{"name":"kixelated","email":"kixelated@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/web-transport_0.1.4_1784221161507_0.9443928824429273"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-17T23:35:26.747Z","modified":"2026-07-16T16:59:22.252Z","0.0.1":"2026-03-17T23:35:26.950Z","0.0.4":"2026-03-18T18:57:00.728Z","0.1.0":"2026-04-02T19:50:19.013Z","0.1.1":"2026-04-02T21:02:10.481Z","0.1.2":"2026-05-30T20:26:47.051Z","0.1.3":"2026-06-22T19:34:15.891Z","0.1.4":"2026-07-16T16:59:21.856Z"},"bugs":{"url":"https://github.com/moq-dev/web-transport/issues"},"license":"(MIT OR Apache-2.0)","homepage":"https://github.com/moq-dev/web-transport#readme","keywords":["webtransport","quic","http3","polyfill","napi"],"repository":{"type":"git","url":"git+https://github.com/moq-dev/web-transport.git"},"description":"WebTransport polyfill for Node.js via QUIC/HTTP3","maintainers":[{"name":"kixelated","email":"kixelated@gmail.com"}],"readme":"# @moq/web-transport\n\nWebTransport for Node.js, powered by native QUIC/HTTP3 via NAPI-RS.\n\nProvides a custom client and server API for setup, then exposes the standard [W3C WebTransport API](https://www.w3.org/TR/webtransport/) for streams, datagrams, and session lifecycle.\n\n## Installation\n\n```bash\nbun add @moq/web-transport\n```\n\n## Client\n\nConnect to a WebTransport server using the `Session` class, which implements the W3C `WebTransport` interface:\n\n```ts\nimport Session from \"@moq/web-transport\";\n\nconst session = new Session(\"https://example.com:4443/path\");\nawait session.ready;\n\n// Use the standard W3C WebTransport API from here on\n```\n\n### Certificate options\n\n```ts\n// Skip certificate verification (testing only!)\nconst session = new Session(\"https://localhost:4443\", {\n\tserverCertificateDisableVerify: true,\n});\n\n// Pin to specific certificate hashes\nconst session = new Session(\"https://localhost:4443\", {\n\tserverCertificateHashes: [\n\t\t{ algorithm: \"sha-256\", value: certHash },\n\t],\n});\n```\n\n### Subprotocol negotiation\n\n```ts\nconst session = new Session(\"https://example.com:4443/path\", {\n\tprotocols: [\"moqt-16\"],\n});\nawait session.ready;\nconsole.log(session.protocol); // \"moqt-16\" (server-selected)\n```\n\n### Polyfill\n\nInstall `Session` as the global `WebTransport` for libraries that expect the browser API:\n\n```ts\nimport { install } from \"@moq/web-transport\";\n\ninstall(); // globalThis.WebTransport = Session (no-op if already defined)\n```\n\n## Server\n\nUse `Server` to accept incoming connections. Each `Request` can be accepted (returning a W3C `Session`) or rejected:\n\n```ts\nimport { Server } from \"@moq/web-transport\";\nimport fs from \"node:fs\";\n\nconst cert = fs.readFileSync(\"cert.pem\");\nconst key = fs.readFileSync(\"key.pem\");\n\nconst server = Server.bind(\"[::]:4443\", cert, key);\n\nwhile (true) {\n\tconst request = await server.accept();\n\tif (!request) break;\n\n\tconst url = await request.url;\n\tconsole.log(\"incoming session:\", url);\n\n\tconst session = await request.ok(); // or request.reject(404)\n\n\t// Use the standard W3C WebTransport API from here on\n\thandleSession(session);\n}\n\n// Stop accepting new connections\nserver.close();\n```\n\n## W3C WebTransport API\n\nOnce you have a `Session` (client or server-side), the API follows the [W3C WebTransport spec](https://www.w3.org/TR/webtransport/):\n\n### Bidirectional streams\n\n```ts\n// Open a bidirectional stream\nconst stream = await session.createBidirectionalStream();\nconst writer = stream.writable.getWriter();\nawait writer.write(new Uint8Array([1, 2, 3]));\nawait writer.close();\n\n// Accept incoming bidirectional streams\nconst reader = session.incomingBidirectionalStreams.getReader();\nconst { value: incoming } = await reader.read();\nconst data = await new Response(incoming.readable).arrayBuffer();\n```\n\n### Unidirectional streams\n\n```ts\n// Open a unidirectional stream\nconst writable = await session.createUnidirectionalStream();\nconst writer = writable.getWriter();\nawait writer.write(new TextEncoder().encode(\"hello\"));\nawait writer.close();\n\n// Accept incoming unidirectional streams\nconst reader = session.incomingUnidirectionalStreams.getReader();\nconst { value: readable } = await reader.read();\nconst text = await new Response(readable).text();\n```\n\n### Datagrams\n\n```ts\n// Send datagrams\nconst writer = session.datagrams.writable.getWriter();\nawait writer.write(new Uint8Array([0x01, 0x02]));\n\n// Receive datagrams\nconst reader = session.datagrams.readable.getReader();\nconst { value: datagram } = await reader.read();\n```\n\n### Closing\n\n```ts\n// Close gracefully\nsession.close({ closeCode: 0, reason: \"done\" });\n\n// Wait for the session to close\nconst info = await session.closed;\nconsole.log(info.closeCode, info.reason);\n```\n\n## License\n\nMIT OR Apache-2.0\n","readmeFilename":"README.md"}