mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-09 15:08:04 -05:00
18 lines
443 B
JavaScript
18 lines
443 B
JavaScript
(function() {
|
|
var protocol = 'ws:';
|
|
if (window.location.protocol === 'https:')
|
|
protocol = 'wss:';
|
|
|
|
var defaultPath = window.location.pathname;
|
|
if (!/\/$/.test(defaultPath))
|
|
defaultPath += '/';
|
|
defaultPath += 'autoreload/';
|
|
|
|
var ws = new WebSocket(protocol + '//' + window.location.host + defaultPath);
|
|
ws.onmessage = function(event) {
|
|
if (event.data === "autoreload") {
|
|
window.location.reload()
|
|
}
|
|
}
|
|
})();
|