diff --git a/routes/api/post.js b/routes/api/post.js index 4302919..7ebd966 100644 --- a/routes/api/post.js +++ b/routes/api/post.js @@ -87,8 +87,9 @@ module.exports = { data: post_obj } let messagestr = JSON.stringify(message) - server.wss.clients.forEach(function(ws) { - if(ws.channel == decodeURIComponent(req.body.receiver)) { + let channel = decodeURIComponent(req.body.receiver) + server.wss.clients.forEach(async function(ws) { + if(ws.channel == channel) { ws.send(messagestr) } });