B4J Question [WebApp] New session

AHilton

Active Member
Licensed User
Longtime User
I have a well-established B4J websocket-based webapp with several pages hidden behind a login page. I pass information between pages with a websocket session; such things as the company the user is logged in as, user, etc that I check on WebSocket_Connected. Users login with their Company code, username and password and that all gets used throughout their course of pages. Everything works just fine.

For the staff of the company that hosts this webapp wants an administration page so that they can see a table of all of the companies and be able to simply click a link to open a new window/tab already logged into that customers' company. They're may want to have several customers' companies open in several windows/tabs at a time. I've done that and it works well except that the session established on the admin page follows along to the subsequent windows/tabs. The last company opened session information (company, user, etc.) is what all of the previously opened companies windows/tabs will use.

So, is there any way, once the main page for a company is opened from the admin page that I can create a new, separate session from the original admin page?
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Session are cookie based, if you can delete the cookies on the client side you will create a new session on the server. Unfortunately the cookies are site wide so you have to be careful if thats what you intend
 
Upvote 0

AHilton

Active Member
Licensed User
Longtime User
Before I go down this rabbit hole and start coding it, would this potentially work ....

For Admin staff, if I could save a cookie client-side with the company, user, etc. information and then read/use that information on the subsequent pages instead of the session information, that might work?


Never mind. That's the same problem from a different direction.
 
Upvote 0

AHilton

Active Member
Licensed User
Longtime User
Another idea, can I use query strings with web socket? So, for normal users I'll just use the standard sessions to pass information around to the pages. But, for Admin users, I could use query strings and just look to see in the WebSocket_Connected if they are there or not an use that information instead of what's in the session?
 
Upvote 0

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
I could use query strings
i dont think you can use the query_strings without doing some manual parsing, if you can send that, just better send JSON and work with it.

I think you should be able to use Maps (thread safe maps) to keep track of users whereabouts and handle the right information
 
Upvote 0
Top