summaryrefslogtreecommitdiff
path: root/server/decorators
diff options
context:
space:
mode:
authorJoseph Ditton <jditton.atomic@gmail.com>2022-03-08 18:18:38 -0700
committerJoseph Ditton <jditton.atomic@gmail.com>2022-03-08 18:18:38 -0700
commit1b7c6ee006b50ce29c9cb3ee42fad29b7db0f6f3 (patch)
tree3e9cd6e10f81a65f76478910f6feb1b89d6ce1dc /server/decorators
parent0f1009bf0ab0c79f480e8160a796d59e36d522fb (diff)
downloadlocchat-1b7c6ee006b50ce29c9cb3ee42fad29b7db0f6f3.tar.gz
locchat-1b7c6ee006b50ce29c9cb3ee42fad29b7db0f6f3.zip
finish gateway websocket example
Diffstat (limited to 'server/decorators')
-rw-r--r--server/decorators/gateway_jwt_body.decorator.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/server/decorators/gateway_jwt_body.decorator.ts b/server/decorators/gateway_jwt_body.decorator.ts
new file mode 100644
index 0000000..c31b47e
--- /dev/null
+++ b/server/decorators/gateway_jwt_body.decorator.ts
@@ -0,0 +1,6 @@
+import { createParamDecorator, ExecutionContext } from '@nestjs/common';
+import { Socket } from 'socket.io';
+export const GatewayJwtBody = createParamDecorator((data: unknown, ctx: ExecutionContext) => {
+ const req = ctx.switchToHttp().getRequest() as Socket;
+ return req.handshake.auth.jwtBody;
+});