we did it
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user