WebSocket issues


#1

Hi,

I am experiencing an issue in our ShinyProxy Environment - as the screen sometimes turns into grey when launching an application that I have just built.

Although I cannot share the app here - but it is actually super-simple. There is a navbarpage in the front and it loads a data (around 1000 rows and 50 columns) from our database and simply displays it with rhandsontable. Since it takes a lot of time to load, I use spinners - to show that the page is loading.

For reasons - I would not discuss here - it takes around 20s to load and display the table if everything works out all right.

Around 5 times out of 10 - the screen turns into grey before it loads the table in the main page. Every single time when the page fails to load - Chrome keeps telling me that the websocket connection failed.

Issue1

In Rstudio - everything works just fine - and initialising the application on its own in seperate Docker image - it works all right. The error is not reproducible there. I tried everything I can - but I cannot figure out what is the root of the problem.

Neither the data nor the script does not have special characters - so it suprises me the Chrome says that it is related with UTF-8.

Since I have already launched quite a few applications with ShinyProxy - and I have never experienced anything like this - it remains an open question to me - what can cause this error.

When launcing the ShinyProxy in debug mode - it does not report any error message when the screen turns into grey…
If you have any idea, please let me know.

Thanks in advance,

Tamas


#2

Hi, from your statement that the app needs around 20s to launch, I guess you should set the container-wait-time to 40s or more (the default is 20s)

  • container-wait-time : timeout for the container to be available to ShinyProxy; defaults to 20s ( 20000 ):

see https://www.shinyproxy.io/configuration/


#3

Hi,

I think that timeout value is set for the containers. If the container does not initialise itself within 20s, then it reports an error message.

But now the whole page can load - only the table is not working properly. I also discovered that it is not the data collection that takes time. That is pretty fast actually.

Instead, it takes a lot of time is to draw the table in the UI.

I am wondering if there any additional timeout parameter that may be responsible for this.

Thanks in advance,

Tamas


#4

You are right. That timeout is should for containers initializing. I tried various ways to reproduce your issue but failed.

Do you use reverse proxy like nginx? Maybe related to the param of proxy_read_timeout of ngnix? I don’t know…

A workaround I can think of is to use DT rather than rhandsome. It’s because DT supports the server processing mode (server = TRUE) and the table should be loaded very fast in your cases…


#5

Agreed - but I have very good reasons for using rHandsontable rather than DT.

When a datatable object is editable - then there is no way to define dropdowns for columns. Even if it looks much better and nicer - from a functionality point of view - there are pretty serious limitations. Handsontable works much like an excel editor - and people tend to like that - rather than datatables that work nicely - but cannot be maintained for a longer period of time in an enterprise context when it comes to standardization.

My initial workaround was that I created some Bootstrap Modal - and pre-defined each of the filters for each column. So when the users wanted to edit a row - then it has to be highligted at fitst - and then they had to press a button - that generated a pop-up like window - where I could define the filters in the proper way. It worked pretty nicely - I also have a working version but people do not prefer this solution because if they want to edit 20 rows say, 1 cell in each row, then it requires so many clicking - and it is simply not efficient. This also makes sense from their point of view - so I decided to stay with Handsontable since it does the job - and there is currently no better alternative.

I will try and create a reproducible example - but it is not going to be easy since it only fails to work in ShinyProxy - and no error message is reported - only the one that I can see in Chrome when it is deployed in a ShinyProxy Environment. And the error message is always the same as seen in the screenshot… Nothing else - even in Debug mode. :frowning:

What is also interesting is that the screen turns into grey sometimes - even if the table is drawn. We have more than 10 deployed applications - and we never experienced anything like this - so I doubt if our configurations were wrong. But I will give nginx a try and I will get back to you.

Tamas


#6

That’s true. rhandsontable is preferred if you need something close to Excel. Editing content is not that nice in DT… My not-that-elegant solution is let the user download an Excel file, editing the data in the real Excel and uploading to the server again… :sweat_smile: It’s off-topic…

It sounds like the websockets were closed by something due to long-time respond. I doubt it may relate to Ngnix but who knows … :crazy_face: