Watch party refresh: Chat/Queue/Room tabs, host transport, gentle sync, heartbeat and latency-aware reconnect, in-place section updates

This commit is contained in:
Jonathan Sykes
2026-10-15 20:19:44 +08:00
parent 23097918e9
commit 088937d4de
12 changed files with 550 additions and 84 deletions

16
tests/fixtures/party-server.mjs vendored Normal file
View File

@@ -0,0 +1,16 @@
// Isolated integration harness: real party relay and frontend chunk; deterministic player.
import { createPartyHub } from '../../server/party.js';
import { join } from 'node:path';
const root = new URL('../../frontend/', import.meta.url).pathname;
const hub = createPartyHub();
const server = Bun.serve({ hostname: '127.0.0.1', port: Number(process.env.PARTY_TEST_PORT || 0),
async fetch(req, srv) {
const path = new URL(req.url).pathname;
if (path === '/ws/party') return hub.upgrade(req, srv, '127.0.0.1');
if (path === '/') return new Response(await Bun.file(new URL('party.html', import.meta.url)).text(), { headers: { 'Content-Type': 'text/html' } });
if (path === '/party-fixture.js') return new Response(Bun.file(new URL('party-fixture.js', import.meta.url)));
if (path.includes('..')) return new Response('', {status: 400});
return new Response(Bun.file(join(root, path)));
}, websocket: hub.websocket,
});
console.log(`http://127.0.0.1:${server.port}`);