|
|
|
@ -52,13 +52,13 @@ server.listen(port, () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
for await (const [buff] of receiver) {
|
|
|
|
|
const jobId = buff.slice(0, 32).toString();
|
|
|
|
|
const jobId = buff.subarray(0, 32).toString();
|
|
|
|
|
console.log(`Received ${jobId}`);
|
|
|
|
|
const res = clients[jobId];
|
|
|
|
|
if (!res) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
res.write('event: message\n');
|
|
|
|
|
res.write(`data: ${encodeURIComponent(buff.slice(32).toString())}\n`);
|
|
|
|
|
res.write(`data: ${encodeURIComponent(buff.subarray(32).toString())}\n`);
|
|
|
|
|
res.write('id: 0\n');
|
|
|
|
|
}
|
|
|
|
|