37 lines
920 B
C++
37 lines
920 B
C++
#include <QApplication>
|
|
#include <QSslSocket>
|
|
|
|
#include "stompframe.h"
|
|
|
|
int main(int argc, char *argv[]) {
|
|
QApplication application(argc, argv);
|
|
|
|
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);
|
|
|
|
|
|
|
|
STOMPFrame(STOMPFrame::MESSAGE, {
|
|
{},
|
|
}).send(socket);
|
|
return application.exec();
|
|
}
|