ggvis
ggvis copied to clipboard
ggvis not rendering interactive plots with rstudio server
Love the idea of ggvis as using shiny and ggplot a lot at the moment. But ggvis is not rendering interactive plots in RStudio-server .
- RStudio server version 0.98.953 running on ubuntu.
- R 3.0.2
- Shiny-server 1.2.0.359 also running on same server.
- ggvis 0.3.0.1
- shiny 0.10.0
- Firefox 30.0 OR chrome 35.0.1916.153 m
This renders as expected:
mtcars %>%
ggvis(~wt, ~mpg) %>%
layer_points()
When trying to render the following, "viewer" window flashes but nothing appears. Message appears as expected:
Showing dynamic visualisation. Press Escape/Ctrl + C to stop
mtcars %>%
ggvis(~wt, ~mpg) %>%
layer_smooths(span = input_slider(0.5, 1, value = 1)) %>%
layer_points(size := input_slider(100, 1000, value = 100))
ggvis plots on http://ggvis.rstudio.com/ etc. render as expected.
Firefox or chrome both same. Appreciate any suggestions. Thank you!
Sorry, I'm not able to reproduce this problem, on a remote machine with an older version of RStudio server, 0.98.484, and R 3.1.0.
It seems unlikely that it's a browser issue. If you open your browser's Javascript console, does it report anything strange?
Thanks Winston.
Yes, this is reported: TypeError: mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create d3.min.js:3
Firefox can't establish a connection to the server at wss://rserver.is.ed.ac.uk/p/4229/websocket/. shiny.js:521
The latter references this line from shiny.js var ws = new WebSocket(protocol + '//' + window.location.host + defaultPath);
I use rstudio and shiny all day everyday on this server and haven't had connection problems before, but there may be a server issue I'm not aware of.
I am having the same issue.
I am running RStudio server Version 0.98.944 with Chrome
My js console says this: WebSocket connection to 'ws://rstudio-dev/p/6069/websocket/' failed: Error during WebSocket handshake: Unexpected response code: 404
I am having same issue. RStudio 0.98.1028 ggvis_0.3.0.9001 shiny_0.10.1.9002
RStudio Server is running on Centos 6 and client is ubuntu 14.04
In chrome unstable in js console: Failed to load resource: net::ERR_CACHE_MISS
In chrome beta no error
Firefox Aurora: mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create Firefox can't establish a connection to the server at wss://[ip adress here]]/rstudio/p/7876/websocket/
I can give you access to a test account on my server if that would help? Ewen
Hi, Looks like with the latest rstudio server ( v0.98.1062) it's not a problem any more. Mateusz
@ewenharrison Have you tried with a recent version of RStudio Server? If so, it might be helpful if I can log into your machine. You can contact me directly at [email protected].
@ewenharrison we poked around on your server and it looks like you're using Apache as a proxy. You'll also need to configure it to proxy websocket connections.
See this: http://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html
You'll probably need to add something like this (untested):
ProxyPassMatch ^/p/([0-9]+)/websocket/$ wss://localhost:8787/p/$1/websocket/
You might also need to use ws
instead of wss
.
Winston,
Thank you very much for your help with this. I'm serving RStudio and Shiny from the same server, as you say with an apache2 proxy.
I got it working with the following directive added to the apache2 configuration:
<LocationMatch ^/p/([0-9]+)/websocket/$> ProxyPassMatch wss://localhost:8787/p/$1/websocket/ <\LocationMatch>
Many thanks again.
Best wishes,
Ewen
On 20 October 2014 20:43, Winston Chang [email protected] wrote:
@ewenharrison https://github.com/ewenharrison we poked around on your server and it looks like you're using Apache as a proxy. You'll also need to configure it to proxy websocket connections.
See this: http://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html
You'll probably need to add something like this (untested):
ProxyPassMatch ^/p/([0-9]+)/websocket/$ wss://localhost:8787/p/$1/websocket/
You might also need to use ws instead of wss.
— Reply to this email directly or view it on GitHub https://github.com/rstudio/ggvis/issues/219#issuecomment-59827456.
Ewen M Harrison MB ChB PhD FRCS (Gen Surg) Senior Lecturer in General Surgery Consultant Transplant and Hepatobiliary Surgeon MRC Centre for Inflammation Research University of Edinburgh Royal Infirmary of Edinburgh Edinburgh EH16 4SA
Mobile. +44 (0) 797 442 0495 [email protected] @ewenharrison
Hi,
I had to built the ggvis package from github using devtools.
As I am using nginx therefore included the following lines in /etc/nginx/sites-enabled/default
for ubuntu 14.04, in order to enable proxy and websocket:
location / {
proxy_pass http://127.0.0.1:8787;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
The R environment details, in case required, are mentioned below:
> R.version
_
platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 3
minor 2.0
year 2015
month 04
day 16
svn rev 68180
language R
version.string R version 3.2.0 (2015-04-16)
nickname Full of Ingredients
RStudio version used is: 0.98.1103
Regards, Gourav
@ewenharrison, I encountered the same issue and I tried your solution yet it didn't seem to work in my case. I also used apache2 as proxy to Rshiny server (port 8383)
when I run my R shiny app (in the directory of testapp under site_dir ) from firefox, the app interface can be shown then it stopped short with error message in error log:
Firefox can't establish a connection to the server at ws://mydomainname.edu/shinyport/testapp/sockjs/883/iy9jjfoj/websocket.
as I observed, the websocket didn't get to pass through with the original host name (www.mydomainname.edu) so I tried your solution, and added this in the apache2 configuration
<LocationMatch ^/testapp/_sockjs_/([0-9]+)/([a-z0-9]+)/websocket$>
ProxyPassMatch ws://localhost:8383/testapp/_sockjs_/$1/$2/websocket
</LocationMatch>
The websocket changes on the two fields after "sockjs/" so I used regex to substitute them in ProxyPassMatch, however it still failed. I even confirmed the regex on a regular expression tester, but why it doesn't work in my case?
Any help is highly appreciated. It bothered me for a long while already.
@slowsmile
You haven't provided enough information. Please provide the whole relevant section from your apache2 configuration file. What regex expression are you using? It doesn't look right. Are you using a <Location> directive? You can't have "testapp" in ProxyPassMatch as that will change with each shiny application. You could try this:
<Proxy *> Allow from localhost </Proxy>
ProxyPass / http://localhost:8383/ ProxyPassReverse / http://localhost:8383/ ProxyPassMatch ^/shinyport/(.+)/websocket/$ ws://localhost:8383/shinyport/$1/websocket/
Untested. You may need to escape the / with \ in the regex, but probably not. You will need to change ws to wss if you are using ssl/443.
On 23 June 2015 at 18:11, slowsmile [email protected] wrote:
@ewenharrison https://github.com/ewenharrison, I encountered the same issue with you and I tried your solution yet it doesn't seem to work in my case. I also used apache2 as proxy to Rshiny server (port 8383)
when I run my R shiny app (in the directory of testapp under site_dir ) from firefox, the app interface can be shown then it stopped short with error message in error log:
Firefox can't establish a connection to the server at ws:// mydomainname.edu/shinyport/testapp/sockjs/883/iy9jjfoj/websocket.
as I observed, the websocket didn't get to pass through with the original host name (www.mydomainname.edu) so I tried your solution, and added this in the apache2 configuration
ProxyPassMatch ws://localhost:8383/testapp/sockjs/$1/$2/websocket
The websocket changes on the two fields after "sockjs/" so I used regex to substitute them in ProxyPassMatch, however it still failed. I even confirmed the regex on a regular expression tester, but why it doesn't work in my case?
Any help is highly appreciated. It bothered me for a long while already.
— Reply to this email directly or view it on GitHub https://github.com/rstudio/ggvis/issues/219#issuecomment-114575136.
Ewen M Harrison MB ChB PhD FRCS (Gen Surg) Senior Lecturer in General Surgery | Consultant Transplant and Hepatobiliary Surgeon Director ChM General Surgery | GlobalSurg Research Collaborative Surgical and Perioperative Health Research (SPHeRe) Clinical Surgery University of Edinburgh | Royal Infirmary of Edinburgh | Edinburgh | EH16 4SA
Mobile: +44 (0) 797 442 0495 [email protected] Web: University of Edinburgh http://www.ed.ac.uk/schools-departments/surgery/staff/surgical-profiles/ewen-harrison | DataSurg http://datasurg.net | ChM General Surgery http://www.chm.rcsed.ac.uk | GlobalSurg http://globalsurg.org Twitter: @ewenharrison Skype: ewen.harrison
@ewenharrison Thanks for your response and followed your suggestions, but the error message remains. Here is the section in my apache config file
<Directory />
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
# Order deny,allow
# Allow from all
Require all granted
</Directory>
ProxyRequests On
ProxyVia On
<Proxy *>
Require all granted
</Proxy>
ProxyPass /shinyport/ http://localhost:8383/
ProxyPassReverse /shinyport/ http://localhost:8383/
RedirectMatch permanent ^/shinyport$ /shinyport/
ProxyPassMatch ^/shinyport/(.+)/websocket$ wss://localhost:8383/$1/websocket
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Basically, I forward to port 8383 from default 80 if the user opens www.mydomainname.edu/shinyport and there are several R-shiney apps in /shinyport including /BrainSpanapp
I was able to open the app panel but the websocket always failed to connect. Here is the message again
Firefox can't establish a connection to the server at ws://mydomainname.edu/shinyport/BrainSpanapp/sockjs/912/8_iofafc/websocket.
Any additional suggestion is highly appreciated!
Hi,
It's difficult without being able to test it I'm afraid. The ProxyPassMatch statement doesn't look like it will owrk as it misses out /shinyport/ from the wss address. My last suggestion: Replace:
ProxyPass /shinyport/ http://localhost:8383/ ProxyPassReverse /shinyport/ http://localhost:8383/ RedirectMatch permanent ^/shinyport$ /shinyport/ ProxyPassMatch ^/shinyport/(.+)/websocket$ wss://localhost:8383/$1/websocket
with:
<Location /shinyport>
ProxyPass http://localhost:8383/shinyport
ProxyPassReverse http://localhost:3838/shinyport
</Location>
<LocationMatch ^/shinyport/(.*)/websocket$>
ProxyPassMatch wss://localhost:8383/shinyport/$1/websocket
</LocationMatch>
Make sure in /etc/shiny-server/shiny-server.conf you have: location /shinyport { }
Ewen
On 24 June 2015 at 17:37, slowsmile [email protected] wrote:
@ewenharrison https://github.com/ewenharrison Thanks for your response and followed your suggestions, but the error message remains. Here is the section in my apache config file
<Directory /> #Options FollowSymLinks Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All # Order deny,allow # Allow from all Require all granted </Directory> ProxyRequests On ProxyVia On <Proxy *> Require all granted </Proxy> ProxyPass /shinyport/ http://localhost:8383/ ProxyPassReverse /shinyport/ http://localhost:8383/ RedirectMatch permanent ^/shinyport$ /shinyport/ ProxyPassMatch ^/shinyport/(.+)/websocket$ wss://localhost:8383/$1/websocket # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined
Basically, I forward to port 8383 from default 80 if the user opens www.mydomainname.edu/shinyport and there are several R-shiney apps in /shinyport including /BrainSpanapp
I was able to open the app panel but the websocket always failed to connect. Here is the message again
Firefox can't establish a connection to the server at ws:// mydomainname.edu/shinyport/BrainSpanapp/sockjs/912/8_iofafc/websocket.
Any additional suggestion is highly appreciated!
— Reply to this email directly or view it on GitHub https://github.com/rstudio/ggvis/issues/219#issuecomment-114936229.
Ewen M Harrison MB ChB PhD FRCS (Gen Surg) Senior Lecturer in General Surgery | Consultant Transplant and Hepatobiliary Surgeon Director ChM General Surgery | GlobalSurg Research Collaborative Surgical and Perioperative Health Research (SPHeRe) Clinical Surgery University of Edinburgh | Royal Infirmary of Edinburgh | Edinburgh | EH16 4SA
Mobile: +44 (0) 797 442 0495 [email protected] Web: University of Edinburgh http://www.ed.ac.uk/schools-departments/surgery/staff/surgical-profiles/ewen-harrison | DataSurg http://datasurg.net | ChM General Surgery http://www.chm.rcsed.ac.uk | GlobalSurg http://globalsurg.org Twitter: @ewenharrison Skype: ewen.harrison