diff options
| author | Luke Hoersten <[email protected]> | 2026-06-15 09:46:21 -0500 |
|---|---|---|
| committer | Luke Hoersten <[email protected]> | 2026-06-15 09:46:21 -0500 |
| commit | 103486c722907cc4aefdebe606e28ea5c9565901 (patch) | |
| tree | ac0850cf2f6508c8169d9831313278e700db6c80 /main/state_machine.h | |
| parent | e85b67b902e678b5c2517b656c1ca95435cf6aec (diff) | |
scrypted: make undici dispatcher optional, fall back to per-POST sockets
Scrypted's plugin sandbox doesn't always expose 'undici' as a
require()-able module — it's bundled into the runtime but only
reachable through globalThis.fetch internals, not as a CommonJS
module. require('undici') threw and broke registerViewport entirely.
Wrap the require in try/catch and cache the result. When undici is
available we still get keep-alive + 2 socket pool for pipelining;
when it isn't, dispatcherFor returns undefined and we fall back to
plain fetch with a fresh socket per POST. The X-Frame-Seq
deduplication on the firmware side still works regardless — even
without socket pooling, two fetch() calls can be in flight on two
separate ephemeral sockets concurrently.
Diffstat (limited to 'main/state_machine.h')
0 files changed, 0 insertions, 0 deletions
