Skip to content

Commit

Permalink
Add token in header for websocket in Gameroom
Browse files Browse the repository at this point in the history
  • Loading branch information
Haaaan1 committed May 9, 2024
1 parent d2e9aea commit 240a720
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/components/views/Gameroom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,8 @@ const Gameroom = () => {
const receiptId = uuidv4();
stompClientRef.current?.send(
`/app/message/users/enterroom/${currentRoomID}`,
{ receiptId: receiptId },
{ receiptId: receiptId,
token: sessionStorage.getItem("token") },
JSON.stringify(payload)
);
requestLists.current.push({ type: "enter",receiptId: receiptId });
Expand Down Expand Up @@ -429,7 +430,8 @@ const Gameroom = () => {
const receiptId = uuidv4();
stompClientRef.current?.send(
`/app/message/users/ready/${currentRoomID}`,
{ receiptId: receiptId },
{ receiptId: receiptId,
token: sessionStorage.getItem("token") },
JSON.stringify(payload)
);
requestLists.current.push({ type: "ready",receiptId: receiptId });
Expand Down Expand Up @@ -461,7 +463,8 @@ const Gameroom = () => {
const receiptId = uuidv4();
stompClientRef.current?.send(
`/app/message/users/unready/${currentRoomID}`,
{ receiptId: receiptId },
{ receiptId: receiptId,
token: sessionStorage.getItem("token") },
JSON.stringify(payload)
);
requestLists.current.push({ type: "unready",receiptId: receiptId });
Expand Down Expand Up @@ -493,7 +496,8 @@ const Gameroom = () => {
const receiptId = uuidv4();
stompClientRef.current?.send(
`/app/message/games/start/${currentRoomID}`,
{ receiptId: receiptId },
{ receiptId: receiptId,
token: sessionStorage.getItem("token") },
JSON.stringify(payload)
);
requestLists.current.push({ type: "start",receiptId: receiptId });
Expand Down Expand Up @@ -527,7 +531,8 @@ const Gameroom = () => {
const receiptId = uuidv4();
stompClientRef.current?.send(
`/app/message/users/exitroom/${currentRoomID}`,
{ receiptId: receiptId },
{ receiptId: receiptId,
token: sessionStorage.getItem("token") },
JSON.stringify(payload)
);
// requestLists.current.push({ type: "leave",receiptId: receiptId });
Expand Down Expand Up @@ -562,7 +567,8 @@ const Gameroom = () => {
const receiptId = uuidv4();
stompClientRef.current?.send(
`/app/message/games/validate/${currentRoomID}`,
{ receiptId: receiptId },
{ receiptId: receiptId,
token: sessionStorage.getItem("token") },
JSON.stringify(payload)
);
requestLists.current.push({ type: "submit",receiptId: receiptId });
Expand Down Expand Up @@ -603,7 +609,8 @@ const Gameroom = () => {
const receiptId = uuidv4();
stompClientRef.current.send(
`/app/message/games/audio/upload/${currentRoomID}`,
{ receiptId: receiptId },
{ receiptId: receiptId,
token: sessionStorage.getItem("token") },
JSON.stringify(payload)
);
requestLists.current.push({ type: "upload",receiptId: receiptId });
Expand Down

0 comments on commit 240a720

Please sign in to comment.