summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/webchannel/standalone/index.html3
-rw-r--r--examples/webchannel/standalone/main.cpp9
2 files changed, 9 insertions, 3 deletions
diff --git a/examples/webchannel/standalone/index.html b/examples/webchannel/standalone/index.html
index cc3d72d..b5a9a49 100644
--- a/examples/webchannel/standalone/index.html
+++ b/examples/webchannel/standalone/index.html
@@ -14,7 +14,8 @@
if (location.search != "")
var baseUrl = (/[?&]webChannelBaseUrl=([A-Za-z0-9\-:/\.]+)/.exec(location.search)[1]);
else
- var baseUrl = "ws://localhost:12345");
+ var baseUrl = "ws://localhost:12345";
+
output("Connecting to WebSocket server at " + baseUrl + ".");
var socket = new WebSocket(baseUrl);
diff --git a/examples/webchannel/standalone/main.cpp b/examples/webchannel/standalone/main.cpp
index 9c03370..bd2b0a9 100644
--- a/examples/webchannel/standalone/main.cpp
+++ b/examples/webchannel/standalone/main.cpp
@@ -38,8 +38,8 @@
#include <QVariantMap>
#include <QDesktopServices>
#include <QUrl>
-#include <QDebug>
-
+#include <QDir>
+#include <QFileInfo>
#include <QtWebSockets/QWebSocketServer>
#include "../shared/websocketclientwrapper.h"
@@ -111,6 +111,11 @@ int main(int argc, char** argv)
{
QApplication app(argc, argv);
+ QFileInfo jsFileInfo(QDir::currentPath() + "/qwebchannel.js");
+
+ if (!jsFileInfo.exists())
+ QFile::copy(":/qtwebchannel/qwebchannel.js",jsFileInfo.absoluteFilePath());
+
// setup the QWebSocketServer
QWebSocketServer server(QStringLiteral("QWebChannel Standalone Example Server"), QWebSocketServer::NonSecureMode);
if (!server.listen(QHostAddress::LocalHost, 12345)) {