| 196 | // compression ratio when it's enabled on the wire. |
| 197 | const PAYLOAD_MODE = process.env.SOAK_PAYLOAD ?? "incompressible"; |
| 198 | function payloadBytes(seed) { |
| 199 | const out = new Uint8Array(PAYLOAD_B); |
| 200 | if (PAYLOAD_MODE === "text") { |
| 201 | const filler = `change ${seed} \u2014 the quick brown fox jumps over the lazy dog. `; |
| 202 | const bytes = new TextEncoder().encode(filler); |
| 203 | for (let i = 0; i < PAYLOAD_B; i++) out[i] = bytes[i % bytes.length]; |
| 204 | } else { |
| 205 | for (let i = 0; i < PAYLOAD_B; i++) out[i] = (seed * 31 + i) & 0xff; |
| 206 | } |
| 207 | return out; |
| 208 | } |
| 209 | |
| 210 | // Persistent capnweb WebSocket session against B. Reused |
| 211 | // across the soak; one upgrade, many push round-trips. |