we did it

This commit is contained in:
2025-08-30 22:30:31 -04:00
parent 01a12ec58a
commit 11f21221ee
8 changed files with 61 additions and 72 deletions

View File

@@ -80,14 +80,13 @@ const api = new Elysia({ prefix: "/api" })
body: WsIn,
response: WsOut,
open: ({
open({
data: {
params: { tableKey },
humanKey,
},
send,
}) => {
console.log("websocket opened");
}) {
const table = liveTable(tableKey);
table.inputs.connectionChanges.emit({
@@ -103,7 +102,7 @@ const api = new Elysia({ prefix: "/api" })
);
},
message: (
message(
{
data: {
humanKey,
@@ -111,20 +110,25 @@ const api = new Elysia({ prefix: "/api" })
},
},
body
) => liveTable(tableKey).inputs.messages.emit({ ...body, humanKey }),
) {
liveTable(tableKey).inputs.messages.emit({ ...body, humanKey });
},
close: ({
close({
data: {
params: { tableKey },
humanKey,
},
}) =>
}) {
liveTable(tableKey).inputs.connectionChanges.emit({
humanKey,
presence: "left",
}),
});
},
error: (error) => err(error),
error(error) {
err(error);
},
});
export default api;