forked from sj26/skinny
-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
Hi,
Is it possible to access a user's session data from a route that's handling a websocket?
get "/room/:id" do |room_id|
room = Room.find(room_id)
user = User.find(session[:uid])
if RoomConnAuthorizer.new(room, user).authorized?
request.websocket do |ws|
ws.onopen { publish(room, "#{user.name} connected.") }
ws.onclose { publish(room, "#{user.name} disconnected.") }
end
else
401
end
endIs something like this possible? How does one authorize connecting users? The session appears to contain some information, such as session_id, but none of the custom data (such as session[:uid]) that has been previously set.
Any help much appreciated!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels