Skip to content

Commit 32bbb94

Browse files
committed
Minor fixes
1 parent e550c37 commit 32bbb94

File tree

3 files changed

+2
-27
lines changed

3 files changed

+2
-27
lines changed
Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,12 @@ exports.socketHandlers = (wss) => {
7373
} else {
7474
girls.push({ socketId: ws.id, user, ws });
7575
}
76-
77-
console.log("Joined ", user.email);
78-
// Stats will be sent via polling interval
79-
// console.log("BOYS:" , boys)
80-
// console.log("GIRLS : " , girls)
8176
}
8277

8378
if (event === "chat_message") {
8479
const { roomId, message } = data;
8580
const room = rooms[roomId];
8681
if (!room || !room.members.includes(ws.id)) return;
87-
88-
console.log(message);
89-
9082
room.members.forEach((id) => {
9183
if (id !== ws.id) {
9284
const peer = room.membersDetails.find((m) => m.socketId === id);
@@ -106,7 +98,6 @@ exports.socketHandlers = (wss) => {
10698
if (!room) return;
10799

108100
if (room.responses.find((r) => r.socketId === ws.id)) return;
109-
// console.log(answer)
110101

111102
const isYes = answer.toLowerCase() === "yes";
112103
if (room.isMatch === undefined) room.isMatch = isYes;
@@ -129,20 +120,13 @@ exports.socketHandlers = (wss) => {
129120
);
130121

131122
room.membersDetails.forEach((m) => {
132-
console.log("CHAT CLOSED FOR ", roomId);
133123
m.ws.send(JSON.stringify({ event: "chat_closed" }));
134124
});
135125

136126
clearTimeout(room.timer);
137127

138-
// console.log(payload[0] && payload[1]);
139-
140128
if (payload[0] && payload[1]) {
141129

142-
// console.log('MATCH in Blind-dating')
143-
// console.log(payload[0])
144-
// console.log(payload[1])
145-
146130
Reply.create([
147131
{
148132
senderEmail: payload[0],
@@ -163,8 +147,6 @@ exports.socketHandlers = (wss) => {
163147
"THE SPEED DATING PAIR WHERE NOT UPDATED IN DATABASE DUE TO INSERT FAIL",
164148
);
165149
});
166-
167-
// console.log("Updates sent")
168150
}
169151

170152
delete rooms[roomId];
@@ -221,7 +203,6 @@ exports.socketHandlers = (wss) => {
221203
});
222204

223205
ws.on("close", () => {
224-
console.log("DISCONNECTED");
225206
cleanup(ws, wss, "partner_disconnected");
226207
});
227208
});

services/socket/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// const { Server } = require("socket.io");
2-
const { socketHandlers } = require("./handlers.js");
3-
const { matchMaking } = require("./matchmaking.js");
2+
const { socketHandlers } = require("./handler.js");
3+
const { matchMaking } = require("./matchmakings.js");
44
const ws = require("ws");
55

66
module.exports = function initSocket(server) {
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ exports.matchMaking = (wss) => {
66
setInterval(() => {
77
if (boys.length < 1 || girls.length < 1) return;
88
let scores = [];
9-
10-
console.log("RUNNING...")
119
for (let i = 0; i < boys.length; i++) {
1210
for (let j = 0; j < girls.length; j++) {
1311
scores.push({
@@ -18,7 +16,6 @@ exports.matchMaking = (wss) => {
1816
}
1917
}
2018

21-
// console.log("SCORES : " , scores);
2219
scores.sort((a, b) => b.score - a.score);
2320

2421
const usedBoys = new Set();
@@ -77,9 +74,6 @@ exports.matchMaking = (wss) => {
7774
rooms[roomId].members.push(p.socketId);
7875
rooms[roomId].membersDetails.push(p);
7976

80-
// console.log(p.socketId);
81-
console.log(p.user.email)
82-
8377
emitTo(p.socketId, "matched", { roomId });
8478
});
8579
const rd = Math.floor(Math.random() * 9 + 1);

0 commit comments

Comments
 (0)