I am using the wai-websockets package (version 3.0.1.1) and I would like to only open a socket if the user has already logged in. I have a piece of middleware that takes care of all the authentication issues and if the user is logged in places a User
record into the Vault
of the WAI request.
Is there some way to access the WAI Request
from the ServerApp
, or in the alternative to inspect the Request
before the it starts and pass the User
value in?
The following basic structure will allow you to analyze the
Request
before passing control to the websockets, and allow you to pass theRequest
value into yourServerApp
if desired: