Stop sending messages back to their senders

This commit is contained in:
osmarks 2018-10-06 11:08:24 +01:00
parent 83f0dc76f1
commit d2a7ef7585
1 changed files with 2 additions and 1 deletions

View File

@ -34,6 +34,7 @@ const broadcast = (wss, msg, sender) => {
if (socket.type === "client") { send = send && (socket.channels.includes(msg.channel) || socket.channels.includes(wildcardChannel)) && socket !== sender }
else if (socket.type === "peer") { send = send && true }
if (send) {
console.log("SENDING")
socket.send(JSON.stringify(toSend))
}
})
@ -103,7 +104,7 @@ const websocketCommandProcessor = (ws, commands) => {
const command = commands[commandName]
if (!command) { throw new Error("No such command " + commandName) }
const sendBack = x => send({type: "result", for: commandName, ...x})
const sendBack = x => send({...x, type: "result", for: commandName})
command(message, sendBack, { ws, ...ctx })
} else {