Skip to content

Commit

Permalink
fixed isConnected method
Browse files Browse the repository at this point in the history
  • Loading branch information
hardikroongta8 committed Mar 29, 2024
1 parent 5919a76 commit d6ebfd0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ app.use((req, res, next) => {
});
app.use(express.json());
app.use(securityKeyMiddleware);
app.use('/test/khokhaEntry/api', khokhaEntryRouter);
app.use(process.env.BASE_URL, khokhaEntryRouter);
app.use(errorHandler);

wss.on('connection', connectionHandler);
Expand All @@ -43,12 +43,13 @@ exports.sendMessageToSocket = (connectionId, data) => {
}

exports.isConnected = (connectionId) => {
var isClientConnected = false;
wss.clients.forEach((client) => {
if(client.connectionId === connectionId){
return true;
isClientConnected = true;
}
});
return false;
return isClientConnected;
}

exports.closeConnection = (connectionId) => {
Expand Down

0 comments on commit d6ebfd0

Please sign in to comment.