Skip to content

Commit

Permalink
Merge pull request #47 from Jiayan-Lim/matching-ui
Browse files Browse the repository at this point in the history
Integrate matching service frontend with backend:
  • Loading branch information
Jiayan-Lim authored Oct 20, 2024
2 parents e4ad18f + 72000de commit ec4545f
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 1,194 deletions.
1 change: 1 addition & 0 deletions backend/matching-service/controllers/matchingController.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const matchmakeUser = async (userId, userName, questions) => {
questions: questions
}, false);
eventEmitter.once(`success-${userId}`, (peerUserId, peerUserName, question) => {

const success_res = {
event: "match-success",
userId: userId,
Expand Down
2 changes: 2 additions & 0 deletions backend/matching-service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ wss.on("connection", (ws) => {
ws.send("Welcome to websocket server");

ws.on('message', async (msg) => {
// console.log(`Received message: ${msg}`);
msg = JSON.parse(msg)
let res;
if (msg.event == "enqueue") {

try {
res = await matchmakeUser(msg.userId, msg.userName, msg.questions)
} catch (failure) {
Expand Down
Loading

0 comments on commit ec4545f

Please sign in to comment.