fix party event

This commit is contained in:
Daniel Bulant 2026-05-04 11:46:17 +02:00
parent 7b8ec190a8
commit 33b35e7735
No known key found for this signature in database
2 changed files with 6 additions and 7 deletions

View file

@ -83,8 +83,7 @@ export type QuizState = {
}; };
export type PartySocketEvent = export type PartySocketEvent =
| { type: "snapshot"; party: Party | null; members: PartyMemberWithUser[] } | { type: "party_status"; party: Party|null; members: PartyMemberWithUser[] }
| { type: "party_status"; party: Party; members: PartyMemberWithUser[] }
| { type: "member_payload"; fromUserId: string; payload: unknown } | { type: "member_payload"; fromUserId: string; payload: unknown }
| { type: "error"; message: string } | { type: "error"; message: string }
| { type: "pong" }; | { type: "pong" };

View file

@ -74,10 +74,10 @@ export const partySocketApp = new Elysia()
if (!membership) { if (!membership) {
ws.send( ws.send(
JSON.stringify({ JSON.stringify({
type: "snapshot", type: "party_status",
party: null, party: null,
members: [], members: [],
}), } as PartySocketEvent),
); );
return; return;
} }
@ -89,10 +89,10 @@ export const partySocketApp = new Elysia()
if (snapshot) { if (snapshot) {
ws.send( ws.send(
JSON.stringify({ JSON.stringify({
type: "snapshot", type: "party_status",
party: snapshot.party, party: snapshot.party,
members: snapshot.members, members: snapshot.members,
}), } as PartySocketEvent),
); );
await broadcastQuizState(ws, membership.partyId); await broadcastQuizState(ws, membership.partyId);
@ -143,7 +143,7 @@ export const partySocketApp = new Elysia()
type: "member_payload", type: "member_payload",
fromUserId: user.id, fromUserId: user.id,
payload: parsed.payload, payload: parsed.payload,
}), } as PartySocketEvent),
); );
}, },
close: async (ws) => { close: async (ws) => {