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:
16
tests/fixtures/party-server.mjs
vendored
Normal file
16
tests/fixtures/party-server.mjs
vendored
Normal 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}`);
|
||||
Reference in New Issue
Block a user