Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [Frontend] Reuse client_session_id from socket's query instead of creating a new one #6564

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1033,11 +1033,13 @@ qx.Class.define("osparc.utils.Utils", {
// Function that creates a unique tabId even for duplicated tabs
getClientSessionID: function() {
const getUniqueSessionId = () => {
const uuid = osparc.utils.Utils.uuidV4();
// before creating a new one, check if the websocket has it set
const webSocket = osparc.wrapper.WebSocket.getInstance().getSocket();
const clientSessionId = webSocket ? webSocket.io.engine.opts.query["client_session_id"] : osparc.utils.Utils.uuidV4();
// Set window.name. This property is persistent on window reloads, but it doesn't get copied in a duplicated tab
window.name = uuid;
sessionStorage.setItem("clientsessionid", uuid);
return uuid;
window.name = clientSessionId;
sessionStorage.setItem("clientsessionid", clientSessionId);
return clientSessionId;
};

let uniqueSessionId = sessionStorage.getItem("clientsessionid");
Expand Down
Loading