This repository has been archived on 2024-10-30. You can view files and clone it, but cannot push or open issues or pull requests.
SDi-STOMP/main.cpp

37 lines
920 B
C++
Raw Normal View History

2023-11-23 08:19:32 +00:00
#include <QApplication>
2023-11-29 10:53:20 +00:00
#include <QSslSocket>
#include "stompframe.h"
2023-11-23 08:19:32 +00:00
int main(int argc, char *argv[]) {
QApplication application(argc, argv);
2023-11-29 10:53:20 +00:00
QSslSocket socket;
socket.setPeerVerifyMode(QSslSocket::VerifyNone);
QObject::connect(&socket, &QSslSocket::readyRead, [&]() {
auto frame = STOMPFrame::receive(socket);
qDebug() << "Connected:" << (frame.command() == STOMPFrame::CONNECTED) << Qt::endl
<< "Version:" << frame.headers().value("version");
});
socket.connectToHostEncrypted("sdi.hevs.ch", 61614);
if(!socket.waitForConnected()) return -1;
STOMPFrame(STOMPFrame::STOMP, {
{"accept-version", "1.2"},
{"host", "/"},
{"login", "sdi10"},
{"passcode", "809c02f36becb0868da98761fe3209f6"}
}).send(socket);
2023-11-29 10:55:52 +00:00
STOMPFrame(STOMPFrame::MESSAGE, {
{},
}).send(socket);
2023-11-23 08:19:32 +00:00
return application.exec();
}