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

Allow for multiple sessions per user/app combination without queuing events #397

Open
dylancis opened this issue Jan 13, 2023 · 6 comments
Labels

Comments

@dylancis
Copy link

dylancis commented Jan 13, 2023

While using ShinyProxy 2.6.1 and setting up the max-instances field to 2 in the YAML, I was expecting a user to be able open the app twice (in 2 different tabs or 2 browser instances) and to interact with each tab without having to wait for the other app to finish the task it was running.

Instead ,I still have the same behaviour that before (ante version 2.6.0) where if I click on 2 long-running tasks on both tabs, I would still have to wait for the first event to complete until the second get kicked in.

docker yaml

Did I misunderstand the feature here? I could not find the answer in GitHub #395 issue.

Thank you very much @tverbeke , Dylan

@LEDfan
Copy link
Member

LEDfan commented Mar 2, 2023

Hi, the max-instances property allows to launch multiple instances of an app (which will start multiple containers). To launch a new instance of an app you have to click the switch instance button, as described on the interface page: https://shinyproxy.io/documentation/ui/#using-multiple-instances-of-an-app
If you just open a new browser tab, it will still use the same instance of the app and thus the same container.

@dylancis
Copy link
Author

dylancis commented Mar 3, 2023

Thanks @LEDfan , can I replicate the Swicth Instance button in a regular shiny app hosted in shinyproxy? The app I have does not have the balck top ribbon you have on your UI example.

@LEDfan
Copy link
Member

LEDfan commented Mar 6, 2023

The black navbar is part of the UI of ShinyProxy. As long as you are using ShinyProxy through it's regular web interface this navbar should be available. Only when you are using the app_direct endpoint the navbar won't be visible.
Can you post your full configuration file (removing any sensitive values) and also the URL you are using to access the application?

@LEDfan LEDfan added the question label Mar 6, 2023
@dylancis
Copy link
Author

dylancis commented Mar 6, 2023

I am not using the ShinyProxy navbar as it does not fir with the design of my app.
image

image

@LEDfan
Copy link
Member

LEDfan commented Mar 6, 2023

Okay, that was not clear for me before. Yes, you can open the "Switch Instance" modal from your application code using the following JavaScript code:

window.parent.Shiny.ui.showInstanceModal();
window.parent.Shiny.instances.eventHandlers.onShow(null);

For example, you can put these lines in the event handler of a button:

<button id="switchInstance">Switch Instance</button>
<script>
document.getElementById("switchInstance").addEventListener("click", function(){
            window.parent.Shiny.ui.showInstanceModal();
            window.parent.Shiny.instances.eventHandlers.onShow(null);
});
</script>

I hope this helps!

@dylancis
Copy link
Author

dylancis commented Mar 8, 2023

Thank you - will have a look at this. I thought that ideally a user will not have to do anytning or click anywhere if i allow them to spin up lets say 2 instances, by just opening a new tab the new instance will be created automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants