summaryrefslogtreecommitdiff
path: root/src/imports/qmlwebsockets/qmlwebsockets_plugin.cpp
diff options
context:
space:
mode:
authorMilian Wolff <mail@milianw.de>2014-03-21 14:49:00 +0100
committerMilian Wolff <milian.wolff@kdab.com>2014-07-02 14:41:09 +0200
commit561e268bd5a3c5b9f578935766506eee2e81d382 (patch)
treeb6e95452c27c69d21fff8605823255aeed72b81d /src/imports/qmlwebsockets/qmlwebsockets_plugin.cpp
parent3f99082f3bb81982e0c6777875fb5c2a1d9033df (diff)
downloadqtwebsockets-561e268bd5a3c5b9f578935766506eee2e81d382.tar.gz
Add initial support for a declarative WebSocketServer.
It comes with basic support for setting up a non-secure server listening on an arbitrary host and port. The name can be set, and whether the server should be listening or accept connections. The error string is also available via a property. When a client connects, a clientConnected(QQmlWebSocket*) signal is emitted. To showcase the usage and functionality, a new qmlwebsocketserver example is added which behaves similar to qmlwebsocketclient. It simply sends messages from a WebSocket to a local WebSocketServer which in turn sends a simple response. Change-Id: Ib6318155ed08cbeea47d820b709764d2e36dcc45 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
Diffstat (limited to 'src/imports/qmlwebsockets/qmlwebsockets_plugin.cpp')
-rw-r--r--src/imports/qmlwebsockets/qmlwebsockets_plugin.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/imports/qmlwebsockets/qmlwebsockets_plugin.cpp b/src/imports/qmlwebsockets/qmlwebsockets_plugin.cpp
index 9c7f2d6..07176da 100644
--- a/src/imports/qmlwebsockets/qmlwebsockets_plugin.cpp
+++ b/src/imports/qmlwebsockets/qmlwebsockets_plugin.cpp
@@ -43,6 +43,9 @@
#include <QtQml>
+#include "qqmlwebsocket.h"
+#include "qqmlwebsocketserver.h"
+
QT_BEGIN_NAMESPACE
void QtWebSocketsDeclarativeModule::registerTypes(const char *uri)
@@ -51,6 +54,7 @@ void QtWebSocketsDeclarativeModule::registerTypes(const char *uri)
// @uri Qt.WebSockets
qmlRegisterType<QQmlWebSocket>(uri, 1 /*major*/, 0 /*minor*/, "WebSocket");
+ qmlRegisterType<QQmlWebSocketServer>(uri, 1 /*major*/, 0 /*minor*/, "WebSocketServer");
}
QT_END_NAMESPACE