Repository navigation
Getting Started
The active package requires:
- macOS 26 or later
- Swift 6.3
- Swift language mode 6
These requirements are declared by both Package.swift and Swift/Package.swift.
Use the repository-root package for application and library integration:
.package(
url: "https://github.com/Pummelchen/WebTransport.git",
exact: "1.1.0"
)The primary library product is WebTransport. Lower-level products are also available for applications that need direct access to the network runtime, HTTP/3, QUIC, TLS, Apple crypto, or loopback UDP modules.
import Foundation
import WebTransport
let client = WebTransportClient(configuration: WebTransportClientConfiguration(
authority: "example.com",
path: "/wt",
origin: "https://example.com",
availableProtocols: ["demo.v1"]
))
let endpoint = WebTransportEndpoint(host: "example.com", port: 443)
let session = try await client.connect(to: endpoint)
let stream = try await session.openBidirectionalStream()
try await stream.send(Data("hello".utf8), endOfStream: true)
let response = try await stream.receive()The runtime uses platform trust by default.
Show the available commands and scenarios:
swift run WebTransportClient --help
swift run WebTransportServer --listStart a local IPv4 server:
swift run WebTransportServer --listen 127.0.0.1:4433 --transport packetConnect from another terminal:
swift run WebTransportClient \
--connect 127.0.0.1:4433 \
--transport packet \
--trust local-self-signedFor IPv6 loopback, use [::1]:4433 for both endpoints.
Real --listen and --connect sessions require packet transport. Frame transport is available only to lower-level conformance scenarios. The local-self-signed trust mode must be selected explicitly and is restricted to localhost, 127.0.0.1, and ::1.
- Read Architecture before changing protocol or runtime behavior.
- Use Development and Testing to select the right validation commands.
- Review Security and Trust before changing trust, parser, crypto, logging, or network input handling.