This commit is contained in:
nvms 2024-09-04 06:13:15 -04:00
parent e8d489bbfe
commit fcab68acf6

View File

@ -25,15 +25,16 @@ const ws = new KeepAliveServer({
ws.registerCommand( ws.registerCommand(
"authenticate", "authenticate",
async (c: WSContext) => { async (c: WSContext<{ token: string >}) => {
const { token } = c.payload;
// use c.payload to authenticate c.connection // use c.payload to authenticate c.connection
return { ok: true, token: "..." }; return { ok: true, token };
}, },
); );
ws.registerCommand( ws.registerCommand(
"throws", "throws",
async (c: WSContext) => { async (c: WSContext<unknown>) => {
throw new Error("oops"); throw new Error("oops");
}, },
); );