Skip to content
Snippets Groups Projects
Commit 46ce17f7 authored by akiraohgaki's avatar akiraohgaki
Browse files

Add port option

parent 48f8b9c2
No related branches found
No related tags found
No related merge requests found
#include <QStringList>
#include <QJsonObject>
//#include <QTranslator>
//#include <QLocale>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include <QCoreApplication>
#include "handlers/confighandler.h"
#include "handlers/systemhandler.h"
#include "handlers/ocshandler.h"
#include "handlers/itemhandler.h"
//#include "handlers/systemhandler.h"
//#include "handlers/ocshandler.h"
//#include "handlers/itemhandler.h"
#include "websockets/websocketserver.h"
int main(int argc, char *argv[])
......@@ -34,11 +36,17 @@ int main(int argc, char *argv[])
clParser.setApplicationDescription(appConfigApplication["description"].toString());
clParser.addHelpOption();
clParser.addVersionOption();
QCommandLineOption clPortOption(QStringList() << "p" << "port", "Port for websocket server [default: 443].", "port", "443");
clParser.addOption(clPortOption);
clParser.process(app);
int port = clParser.value(clPortOption).toInt();
// Setup websocket server
WebSocketServer *webSocketServer = new WebSocketServer(appConfigApplication["id"].toString(), 443, &app);
webSocketServer->start();
WebSocketServer *webSocketServer = new WebSocketServer(appConfigApplication["id"].toString(), port, &app);
if (!webSocketServer->start()) {
qFatal("Failed to start websocket server");
}
return app.exec();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment