-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
Any example how can I join multiple rooms? For example, an admin with 10 websites needs to join 10 rooms created to embed the chat bot on his websites.
So, if I send a request to /chatroom/all-rooms, I need
const socket = usePartySocket({
host: "localhost:8787",
party: "chatroom",
room: "all-rooms",
});
app.use(
"*",
partyserverMiddleware({
options: {
onBeforeConnect: async (req) => {
const token = req.headers.get("authorization");
// Validate token
if (!token) return new Response("Unauthorized", { status: 401 });
// Get room names and join all
if(req.url.endsWith('all-rooms'))
const rooms : string[] = await getRooms(userId, token)
?? proxy to all chatroom/room1
// chatroom/room1
// chatroom/room2
}
}
})
);
Metadata
Metadata
Assignees
Labels
No labels