Skip to content
unitednetworksPublic

Latest commit

 

History

38 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C++/Qt implementation of WAMP protocol

This small library is based on initial version of CppWAMP, but moved to the Qt world. An event loop from boost was replaced by Qt's event loop as well as all other boost components. For data exchange is used QVariant as an universal data type. Library depends on qmsgpack.

Usage:

QTcpSocket socket;
QWamp::Session *session;
QObject::connect(&socket, &QTcpSocket::connected, [&]() {

  session = new QWamp::Session(sessionName, socket, QWamp::Transport::MsgPack, true);

  QObject::connect(session, &QWamp::Session::joined, [&](qint64 s) {
    qDebug() << "Session joined to realm" << config.realm << "with session ID " << s;

    QVariant result = session->call("sum", { 4, 5, 6 });
    qDebug() << "Sum result is" << result.toInt();

  });

  QObject::connect(session, &QWamp::Session::started, [&]() {
    session->join("realm");
  });
});

Working example will be supplied later.