This commit is contained in:
Zoe Roux 2025-12-12 12:05:28 +01:00
parent 16058b92b3
commit 86f4ce2bd8
No known key found for this signature in database

20
api/src/websockets.ts Normal file
View File

@ -0,0 +1,20 @@
import Elysia, { t } from "elysia";
const actionMap: Record<string, ][> = [
]
export const appWs = new Elysia().ws("/ws", {
body: t.Union([
t.Object({
action: t.Literal("ping"),
}),
t.Object({
action: t.Literal("watch"),
entry: t.String(),
}),
]),
message(ws, { message }) {
actionMap[message.action](message);
},
});