Skip to content

HTTP/2 (http/h2)

Vex natively supports HTTP/2 framing and connections out-of-the-box via the http/h2 module without requiring proxy servers like Nginx or Envoy to step-down the stream into HTTP/1.1 before parsing.

This guarantees low-latency RPC traffic (gRPC) can operate directly on Vex servers.

Core H2Conn Operations

For raw handling of multiplexed streams, you can build or intercept HTTP/2 streams natively:

rust
import { H2Conn, H2Settings, H2FrameHeader, parseFrameHeader } from "http/h2";
import { H2_DATA, H2_HEADERS, H2_SETTINGS } from "http/h2";

You can initialize connections from arbitrary active socket file descriptors mapping natively:

Setting & Frame ConstructionDescription
H2Conn.server(fd)Server-side stream intercept connection wrapper.
H2Conn.client(fd)Client-side connection instantiation.
conn.sendPreface()Standardizes connection prefix magic sequence handling.
conn.checkPreface(buf, len): boolVerification parser.
conn.sendSettingsAck()ACKs underlying SETTINGS stream.
conn.sendPing(data, isAck)Emits a non-blocking PING heartbeat over active streams.
conn.sendGoaway(errorCode)Instantly drops connections signaling a GOAWAY terminate.
conn.sendWindowUpdate(streamId, inc)Stream-independent flow control buffering constraints.
conn.sendRstStream(streamId, err)Kills a particular multiplexed streamId.
conn.sendData(streamId, data, len, end)Low-level generic framing output DATA packet block.
conn.sendStringData(streamId, text, end)Syntactic sugar for DATA frames payload matching UTF-8 block streaming.
conn.close()Safe teardown handler.

Released under the MIT License.