I am seriving my webapp via WEBrick. I start a Firefox browser #1. Somewhere along the way it performs: @session[:key] = ''A'' I start a second Firefox browser #2. Somewhere along the way it performs: @session[:key] = ''B'' What I notice: the value of key in browser #1 is now B not A. I check under RAILS_ROOT/tmp/session and find a single session file only (where RAILS is using PStore to write the session data) So whether the browsers are started concurrently, overlapping, or one at a time, the same underlying session is being used. Surely the web system is smart enough to generate different session numbers even if the client browser is on the same IP? Or am I being the idiot? How in the heck can I generate multiple sessions one per client on WEBrick? Will that technique work under Apache or Mongrel which I intend to serve the production version of the site. I attempted to look under http://wiki.rubyonrails.com/rails/pages/HowtoWorkWithSessions but that and related documentation has been down for a while. Shane --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
this has nothing to do with rails and everything to do with session implementation in browsers. Session is one array to the browser. If you open a new window or tab in the same browser, it gets the same session information. This is why you are able to login to, lets say Yahoo Mail, and open a new window and have the mail page open instead of the login screen. This is how it is supposed to work. If you need to check 2 different values for the same session key you should use 2 different browsers (FF, Safari, IE , whatever). peace --jake shane wrote:> I am seriving my webapp via WEBrick. > > I start a Firefox browser #1. Somewhere along the way it performs: > > @session[:key] = ''A'' > > I start a second Firefox browser #2. Somewhere along the way it > performs: > > @session[:key] = ''B'' > > What I notice: the value of key in browser #1 is now B not A. I check > under > RAILS_ROOT/tmp/session and find a single session file only (where RAILS > is using PStore to write the session data) > > So whether the browsers are started concurrently, overlapping, or one > at > a time, the same underlying session is being used. Surely the web > system > is smart enough to generate different session numbers even if the > client > browser is on the same IP? Or am I being the idiot? > > How in the heck can I generate multiple sessions one per client on > WEBrick? > Will that technique work under Apache or Mongrel which I intend to > serve the > production version of the site. > > I attempted to look under > > http://wiki.rubyonrails.com/rails/pages/HowtoWorkWithSessions > > but that and related documentation has been down for a while. > > Shane-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
shane wrote:> > I am seriving my webapp via WEBrick. > > I start a Firefox browser #1. Somewhere along the way it performs: > > @session[:key] = ''A'' > > I start a second Firefox browser #2. Somewhere along the way it > performs: > > @session[:key] = ''B'' > > What I notice: the value of key in browser #1 is now B not A.[snip] This is happening because Rails and your browser identify the session by its _session_id value stored in the browser cookie. Another way to do this is to turn off the browser cookies support and use my plugin for session persistent. Here each time you establish a new connection a new session is created, even within the same browser (new tab) or new browser window. Long www.edgesoft.ca/blog/read/2 - rails articles --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jake Varghese wrote:> this has nothing to do with rails and everything to do with session > implementation in browsers.FYI, I''ve found that this is all very browser dependent. My recollection from looking at this a few months ago was something like this: Mac Safari: each window has its own session Mac Firefox: just one session for all windows/tabs Windows IE: each window has its own session Linux firefox: with tabs, they all have the same session, separate windows have different sessions For safety, the two browser recommendation is a good one. I was developing an app that had two different "users" that interacted with each other. Usually I could just use two different windows for the two different "users", and everything was fine in Safari. Then another team member went to try out my stuff and "everything was broken". Finally realized it was because he was using firefox on linux with tabs for the two users. One has to wonder how many millions of hacker-hours have been wasted over the past twenty years dealing with the incompatibilities/differences between the different computer platforms. Probably if we had all that time back, we could use it to solve a big problem like world peace or how to get honest people to run for public office. jp -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jeff, you''re prolly be right about Safari, but IE7 and 6 both share session & cookie data across windows, i have to deal with that mess every day :) --jake Jeff Pritchard wrote:> Jake Varghese wrote: >> this has nothing to do with rails and everything to do with session >> implementation in browsers. > > FYI, I''ve found that this is all very browser dependent. My > recollection from looking at this a few months ago was something like > this: > > Mac Safari: each window has its own session > Mac Firefox: just one session for all windows/tabs > > Windows IE: each window has its own session > > Linux firefox: with tabs, they all have the same session, separate > windows have different sessions > > > For safety, the two browser recommendation is a good one. I was > developing an app that had two different "users" that interacted with > each other. Usually I could just use two different windows for the two > different "users", and everything was fine in Safari. > > Then another team member went to try out my stuff and "everything was > broken". Finally realized it was because he was using firefox on linux > with tabs for the two users. > > One has to wonder how many millions of hacker-hours have been wasted > over the past twenty years dealing with the > incompatibilities/differences between the different computer platforms. > > Probably if we had all that time back, we could use it to solve a big > problem like world peace or how to get honest people to run for public > office. > > jp-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thank you (and all responders). In the near future I will have to take Long''s advice and move off Pstore based session files anyway which are slow. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---