aboutsummaryrefslogtreecommitdiffstats
path: root/src/app.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-07-04 07:32:42 -0700
committerAdam Soltys <[email protected]>2026-07-04 07:32:42 -0700
commita28302eee33dab5f0829ff6310242beb0a744ef7 (patch)
tree7f6c7950ec49a5b94201cda789030af674feeba6 /src/app.js
parent6cc0dd619e71099675a7cb1b1566cbe2c06b7bc1 (diff)
downloadcoinosv3-a28302eee33dab5f0829ff6310242beb0a744ef7.tar.gz
coinosv3-a28302eee33dab5f0829ff6310242beb0a744ef7.zip
Ark: real-time receives over the SubscribeMailbox gRPC stream
grpcStream() parses gRPC-web frames incrementally off fetch's body stream; the manager keeps a long-lived SubscribeMailbox subscription (auto-reconnect, 3s backoff) whose messages flow through the same duplicate-safe processing as the poll. Receives now land the moment the sender delivers (~sub-second) instead of on the next poll; the poll stays as fallback and to drive in-flight boards/refreshes. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QFAcD4V284DvYZZHP7Rxxy
Diffstat (limited to 'src/app.js')
-rw-r--r--src/app.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/app.js b/src/app.js
index 61b453b..efb0bc4 100644
--- a/src/app.js
+++ b/src/app.js
@@ -42,6 +42,7 @@ function stopArk() {
arkInitGen++;
if (arkTimer) clearInterval(arkTimer);
arkTimer = null;
+ if (ark) ark.stopMailboxStream();
ark = null;
arkConnectPromise = null;
}
@@ -89,7 +90,9 @@ function connectArk() {
ark = mgr;
const tick = () => mgr.sync().catch(() => {});
tick();
- // Regtest rounds are seconds apart; on mainnet a slower poll is plenty.
+ // Receives arrive in real time over the mailbox stream; the poll is the
+ // fallback and what drives in-flight boards/refreshes forward.
+ mgr.startMailboxStream();
arkTimer = setInterval(() => { if (ark === mgr) tick(); }, getNetwork() === 'regtest' ? 5000 : 30000);
render();
return mgr;