ruby - Getting unique session ID in Sinatra -
i have simple web app built using sinatra, sessions enabled.
if understanding correctly, session data stored in encoded cookie. session data changes, value of cookie change also.
i need unique session identifier remains constant through entire session. there such identifier. or must create own unique value , store in session myself?
thanks!
edit: in comment below thought of useful comparison. if had java servlet, use jsessionid unique identifier. need sinatra equivalent jsessionid.
from can tell jsessionid used pass session around in query string, , sinatra doesn't have that, @ least not accessible. sinatra uses rack session management, , default uses cookie store session data. there other session options in rack, memcached, unique session id stored in cookie, there rack abstracts away don't ever need see session id (though still accessible, see documentation).
if want go route messing rack middleware in sinatra, if need unique id, easier generate 1 , store in session.
Comments
Post a Comment