How to crossws websocket Resolver API access getSession?
I am trying to use WebSockets with crossws, I have this piece of code at the beginning:
getUser() uses "use server" and getSession kind of things, so it needs some Context I think.
But this
getUser()
line throws:
I specifically wanted to put the getUser() there, so I don't have to use it inside message(peer), each time message is exchanged getUser is queried.
So what is the proper way to have access to user object taken from the session and the database, so it's readily available on websocket handlers?1 Reply
In fact, I honestly don't understand how this handler works, I thought async resolve(req), method is only called once when the websocket connection is established, but it is called everytime a message is exchanged?
So what is the purpose of a message handler then?