Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. Unable to hit connection/GET/POST request from Qt WebAssembly client to QHttpServer.

Unable to hit connection/GET/POST request from Qt WebAssembly client to QHttpServer.

Scheduled Pinned Locked Moved Unsolved Qt for WebAssembly
1 Posts 1 Posters 256 Views
  • 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.
  • P Offline
    P Offline
    Pradson
    wrote on last edited by
    #1

    Hello,

    I have tried to run below mentioned code in desktop with QHttpServer module, it is working fine. When, I built it using Qt for WebAssembly, then run, the same QML page appears on the browser as the desktop but could not hit the QHttpServer module which is running in the same machine.

    int main(int argc, char *argv[])
    {
      QGuiApplication app(argc, argv);
      test testclass;
    
    auto manager = QSharedPointer<RestAccessManager>::create("http://127.0.0.1", 51391);
    
      AddressBookModel model(manager);
    
      QQmlApplicationEngine engine;
    
     
    
      engine.rootContext()->setContextProperty("testclass", &testclass);
    
      engine.rootContext()->setContextProperty("addressBookModel", &model);
    
     
    
      engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    
      QList<QObject*> root = engine.rootObjects();
    
      if (root.isEmpty())
    
        return -1;
    
     
    
      return app.exec();
    
    }
    

    Kindly suggest accordingly so that I could connect and GET/POST request to QHttpServer module.

    Thanks,

    Pradson

    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