useQuery server side?
I am trying to use one of my queries inside of my websocket server but when I do, the context.user doesn't exist. Even if I make sure that I'm calling this query after the user is authenticated. I'm not sure why context.user isn't populated, but it got me to thinking if maybe I should only be using the queries from the client side? Surely there's a way to do it server side though?
I have this query:
app/src/server/queries.ts
and in my ws-server.ts I'm attempting to use it like this.
The end goal of all this is to emit a signal when the user is authenticated, so that I can make sure that context.user exists, and then I can add the user back into any websocket rooms they belong to as a way to persist that connection between server restarts during development.
I always get a 401 no matter what though, and context.user just doesn't exist. Any suggestions here? I'm not sure what I'm doing wrong.
I have this query:
app/src/server/queries.ts
and in my ws-server.ts I'm attempting to use it like this.
The end goal of all this is to emit a signal when the user is authenticated, so that I can make sure that context.user exists, and then I can add the user back into any websocket rooms they belong to as a way to persist that connection between server restarts during development.
I always get a 401 no matter what though, and context.user just doesn't exist. Any suggestions here? I'm not sure what I'm doing wrong.