diff options
author | Jesus Fernandez <jesus.fernandez@qt.io> | 2018-09-14 13:50:42 +0200 |
---|---|---|
committer | Jesus Fernandez <Jesus.Fernandez@qt.io> | 2018-09-24 11:24:11 +0000 |
commit | 67aa03a4bc18a5de43148bc328229802fad8896b (patch) | |
tree | b100452c86c566db34359c6a08fb51e7f1fab452 | |
parent | da31eaa62c9f4bed76697ee54ad78ccc0d530493 (diff) |
Reload the browser when the socket disconnects
It tries to reload the browser to try to reconnect. If the remote
application closes, the browser will show the default disconnected page.
Doing this the user will know the session ended and it will free the
resources required to have a WebGL context alive in the browser.
[ChangeLog][QtWebGL][General] Reload the browser when the WebSocket
disconnects.
Change-Id: I724d74ef6e44ff6b89e557f77f65fa827198a47d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r-- | src/plugins/platforms/webgl/webqt.jsx | 1 | ||||
-rw-r--r-- | tests/plugins/platforms/webgl/tst_webgl.cpp | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/platforms/webgl/webqt.jsx b/src/plugins/platforms/webgl/webqt.jsx index 9feb0fe..a7de04d 100644 --- a/src/plugins/platforms/webgl/webqt.jsx +++ b/src/plugins/platforms/webgl/webqt.jsx @@ -1086,6 +1086,7 @@ window.onload = function () { }; socket.onclose = function (event) { console.log("Socket Closed (" + event.code + "): " + event.reason); + window.location.reload(); }; socket.onerror = function (error) { console.log("Socket error: " + error.toString()); diff --git a/tests/plugins/platforms/webgl/tst_webgl.cpp b/tests/plugins/platforms/webgl/tst_webgl.cpp index d37f130..157bf45 100644 --- a/tests/plugins/platforms/webgl/tst_webgl.cpp +++ b/tests/plugins/platforms/webgl/tst_webgl.cpp @@ -48,7 +48,7 @@ #include <memory> -#define PORT 8080 +#define PORT 29836 #define PORTSTRING QT_STRINGIFY(PORT) class tst_WebGL : public QObject |