diff --git a/packages/keepalive-ws/README.md b/packages/keepalive-ws/README.md index f00f130..b8057d9 100644 --- a/packages/keepalive-ws/README.md +++ b/packages/keepalive-ws/README.md @@ -25,15 +25,16 @@ const ws = new KeepAliveServer({ ws.registerCommand( "authenticate", - async (c: WSContext) => { + async (c: WSContext<{ token: string >}) => { + const { token } = c.payload; // use c.payload to authenticate c.connection - return { ok: true, token: "..." }; + return { ok: true, token }; }, ); ws.registerCommand( "throws", - async (c: WSContext) => { + async (c: WSContext) => { throw new Error("oops"); }, );