summaryrefslogtreecommitdiff
path: root/examples/websockets/echoclient/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/websockets/echoclient/main.cpp')
-rw-r--r--examples/websockets/echoclient/main.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/examples/websockets/echoclient/main.cpp b/examples/websockets/echoclient/main.cpp
index 91a2535..36157de 100644
--- a/examples/websockets/echoclient/main.cpp
+++ b/examples/websockets/echoclient/main.cpp
@@ -31,12 +31,25 @@
**
****************************************************************************/
#include <QtCore/QCoreApplication>
+#include <QtCore/QCommandLineParser>
+#include <QtCore/QCommandLineOption>
#include "echoclient.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
- EchoClient client(QUrl(QStringLiteral("ws://localhost:1234")));
+
+ QCommandLineParser parser;
+ parser.setApplicationDescription("QtWebSockets example: echoclient");
+ parser.addHelpOption();
+
+ QCommandLineOption dbgOption(QStringList() << "d" << "debug",
+ QCoreApplication::translate("main", "Debug output [default: off]."));
+ parser.addOption(dbgOption);
+ parser.process(a);
+ bool debug = parser.isSet(dbgOption);
+
+ EchoClient client(QUrl(QStringLiteral("ws://localhost:1234")), debug);
QObject::connect(&client, &EchoClient::closed, &a, &QCoreApplication::quit);
return a.exec();