events-backend: initial events store

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-05-22 14:23:10 +02:00
parent 5032c181e7
commit 6b148372c1
2 changed files with 172 additions and 7 deletions
+12 -1
View File
@@ -94,9 +94,20 @@ backend.add(
{ id: 'derp', topics: ['test'] },
]),
);
setTimeout(() => {
console.log(`DEBUG: publish!`);
ws.send(
JSON.stringify([
'req',
1,
'publish',
{ topic: 'test', payload: { foo: 'bar' } },
]),
);
}, 1000);
};
ws.onmessage = event => {
console.log(`DEBUG: event=`, event.data);
console.log(`DEBUG: client event=`, event.data);
};
ws.onerror = event => {
console.log(`Client error`, event.error);