This commit is contained in:
Michal Moskal 2022-03-15 12:54:26 -07:00
Родитель 83a7dc3827
Коммит ac2b901c64
1 изменённых файлов: 1 добавлений и 5 удалений

Просмотреть файл

@ -94,6 +94,7 @@ export async function devToolsCommand(
disableRoleManager: true, disableRoleManager: true,
proxy: true, proxy: true,
}) })
bus.passive = true
bus.on(ERROR, e => error(e)) bus.on(ERROR, e => error(e))
bus.addBridge(bridge) bus.addBridge(bridge)
const processPacket = (message: Buffer | Uint8Array, sender: string) => { const processPacket = (message: Buffer | Uint8Array, sender: string) => {
@ -118,7 +119,6 @@ export async function devToolsCommand(
log(`client: connected (${sender}, ${clients.length} clients)`) log(`client: connected (${sender}, ${clients.length} clients)`)
client.on("message", event => { client.on("message", event => {
const { data } = event const { data } = event
clients.filter(c => c !== client).forEach(c => c.send(data))
processPacket(data, sender) processPacket(data, sender)
}) })
client.on("close", () => removeClient(client)) client.on("close", () => removeClient(client))
@ -158,10 +158,6 @@ export async function devToolsCommand(
const pkt = buf.slice(1, endp) const pkt = buf.slice(1, endp)
if (buf.length > endp) buf = buf.slice(endp) if (buf.length > endp) buf = buf.slice(endp)
else buf = null else buf = null
clients
.filter(c => c !== client)
// this should really be pkt.buffer to get ArrayBuffer but faye-websocket doesn't like that
.forEach(c => c.send(Buffer.from(pkt)))
processPacket(pkt, sender) processPacket(pkt, sender)
} else { } else {
acc = buf acc = buf