B4J Question multiple web sessions

Hilton

Active Member
Licensed User
Longtime User
Hi folks,

I was under the impression that each time any user connected to the web server, the user was given a unique session. I have searched the documentation and could not find anything that cleared my mind on the subject.

I have found that I get the same sessionId for each new tab in the SAME browser (eg google chrome). If I use Firefox at the same time, I get a different sessionId for Firefox, however for each new tab in that same browser I get the same sessionId.

I would like each instance of a login (ie even same user in a different tab of the same browser) to be given a unique sessionId which would allow the same user to be running different aspects of the same application at the same time in differing tabs - for convenience. Failing that, multiple browsers will have to be used. I understand that what I like and get may well be two different things, I just need my head cleared on the subject.

I must reiterate that I am loving the product! Current version is B4J 2.20

Thanks,
Hilton.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The whole purpose of http sessions is to identify a user between different requests.

I have found that I get the same sessionId for each new tab in the SAME browser (eg google chrome). If I use Firefox at the same time, I get a different sessionId for Firefox, however for each new tab in that same browser I get the same sessionId.
This is the expected behavior as each browser maintains its own cookies store.

I would like each instance of a login (ie even same user in a different tab of the same browser) to be given a unique sessionId which would allow the same user to be running different aspects of the same application at the same time in differing tabs - for convenience. Failing that, multiple browsers will have to be used. I understand that what I like and get may well be two different things, I just need my head cleared on the subject.

I recommend you to go over this discussion: http://stackoverflow.com/questions/368653/how-to-differ-sessions-in-browser-tabs

The problem is that cookies are shared between different tabs so it will require all kinds of hacks and fragile workarounds. The simplest solution will probably to use url rewriting and redirect the user to a url with a tab specific parameter.

Note that almost all websites behave this way. You cannot log into the same website from two tabs with different accounts.
 
Upvote 0
Top