walter-h2
v1.0.1
Published
Ultra-fast zero-dependency HTTP/2 multiplexed session pool, pre-compiled headers, auto PING keep-alive & TLS 1.3 resumption engine for Node.js
Maintainers
Readme
walter-h2 ⚡
Ultra-fast zero-dependency HTTP/2 Multiplexed Session Pool, Pre-Compiled HPACK Headers, Auto H2 PING Keep-Alive, and TLS 1.3 Session Resumption Engine for Node.js.
Designed to pair directly with walter-ws and walter-tls for ultra-low-latency parallel HTTP/2 stream firing (fire(payload)), direct Cloudflare IP routing (host + authority), and automatic session.ping() warming.
Installation
npm i walter-h2@latestQuick Usage (with walter-ws)
import WalterH2, { buildH2Payload } from 'walter-h2';
import WebSocket, { prepareClientFrame, extractString } from 'walter-ws';
// 1. Pre-warm 2 persistent HTTP/2 TLS 1.3 sessions directly to IP with auto 4000ms PING frames
const h2Pool = new WalterH2({
authority: 'canary.discord.com',
host: '162.159.135.232',
port: 443,
size: 2, // SRQ = 2
minVersion: 'TLSv1.3',
ciphers: 'TLS_AES_256_GCM_SHA384',
pingInterval: 4000
});
// Listen for JSON responses from any fired stream
h2Pool.on('json', (jsonString) => {
console.log(jsonString);
});
// 2. Pre-build an HTTP/2 PATCH payload ({ headers, body }) once
const patchPayload = h2Pool.buildPayload({
method: 'PATCH',
path: `/api/v9/guilds/${GUILD_ID}/vanity-url`,
headers: {
'authorization': TOKEN,
'x-discord-mfa-authorization': mfa,
'content-type': 'application/json',
'user-agent': 'Mozilla/5.0'
},
body: `{"code":"walter"}`
});
// 3. Fire across all warm HTTP/2 sessions simultaneously in 0ms!
h2Pool.fire(patchPayload);