feat: add trpc websocket (#205)

This commit is contained in:
Manuel
2024-03-14 18:43:47 +01:00
committed by GitHub
parent 9ae99ad06c
commit 4f375cbe6d
14 changed files with 268 additions and 32 deletions

View File

@@ -1,6 +1,5 @@
import "server-only";
import { TRPCError } from "@trpc/server";
import { observable } from "@trpc/server/observable";
import { createSalt, hashPassword } from "@homarr/auth";
import type { Database } from "@homarr/db";
@@ -99,6 +98,15 @@ export const userRouter = createTRPCRouter({
})
.where(eq(users.id, input.userId));
}),
test: publicProcedure.subscription(() => {
return observable<number>((emit) => {
let counter = 0;
setInterval(() => {
counter = counter + 1;
emit.next(counter);
}, 1000);
});
}),
});
const createUser = async (