Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. Client-Server communication through QWebChannel. Create new QT application processes whenever a new client is connected.

Client-Server communication through QWebChannel. Create new QT application processes whenever a new client is connected.

Scheduled Pinned Locked Moved Unsolved QtWebEngine
1 Posts 1 Posters 514 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Akshay911
    wrote on last edited by Akshay911
    #1

    I have created an opengl based application having HTML UI and c++ logic, connected through QWebChannel.

    For desktop versions(windows/linux), I created QWebEngineView to display the HTML UI. I was able to create-launch-exchange data between html and c++ application successfully.

    Now, I want to create a browser based app using the same HTML UI and C++ logic. I can achieve this using QWebSocketServer, qTcpSocket, QWebChannelAbstractTransport classes and avoid creating webengineview if it is a webapp.

    I want to load my Qt application in a new process whenever a client is connected.

    JsToCppProxy webRelayMsgObj;

    QWebChannel webChannel;
    webChannel.registerObject("JsToCppProxy", &webRelayMsgObj);

    WebSocketTransport pSocketTransport = new WebSocketTransport(m_server->nextPendingConnection());*

    QObject::connect(this, (void(WebSocketServer::)(QWebChannelAbstractTransport))&WebSocketServer::clientConnected,
    &m_WebChannel, &QWebChannel::connectTo);

    emit clientConnected(pSocketTransport);

    WebSocketTransport is derived from QWebChannelAbstractTransport. I picked it up from one of the qt examples.

    Question:

    1. I'm new to socket programming. Above piece of code i have to do in a new Qt process. But m_server instance is in another Qt process. Can I create WebSocketTransport in one process and access the same instance in another Qt process to create QWebChannel(to connect slot)?
    2. QServer resides in one process(which has a qapplication) and my application also has a qapplication.
      Is it fine to create different qapplications in different processes?
      Is there any sample application for this scenario?
      Is the direction I'm proceeding correct? Kindly help, I'm stuck.
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved