Workaround for message id

This commit is contained in:
Erki Aas 2022-10-05 18:18:22 +03:00
parent 6cb78c657f
commit 7797eb9210

View File

@ -31,7 +31,9 @@ async function run() {
console.log("Started watching changes in database"); console.log("Started watching changes in database");
const writeMessage = (response, blob) => { const writeMessage = (response, blob) => {
const message = `id: ${blob._id}\nevent: message\ndata: ${JSON.stringify(blob)}\n\n` // TODO: why no id?
const id = blob._id || null
const message = `id: ${id}\nevent: message\ndata: ${JSON.stringify(blob)}\n\n`
response.write(message) response.write(message)
} }