Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Network communications in QML only

Network communications in QML only

Scheduled Pinned Locked Moved Solved QML and Qt Quick
7 Posts 2 Posters 1.6k Views 2 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.
  • M Offline
    M Offline
    Mark81
    wrote on last edited by Mark81
    #1

    I'm using a commercial device that allows to write QML application only, in Qt 4.8.5.
    I need to find a way to communicate with the outside world but I cannot write the C++ backend, I'm stuck on ly with QML.

    There's no problem to set up a simple TCP Server (even written in Qt) to provide a REST service where my QML files can retrieve the data they need.

    Looking at the documentation of Qt4 I'm not sure if there is a QML Tcp Client class. And QtWebSocket seems to belong to Qt5 only.
    Any idea?

    1 Reply Last reply
    0
    • Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #2

      @Mark81 what about something like this? It relies on some javascript function inside QML and it's 6 years old so it should work with 4.8.5

      BTW, may I ask the name/model of the device you're working with?

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      3
      • M Offline
        M Offline
        Mark81
        wrote on last edited by
        #3

        Yeah, I always forget I can use JavaScript :-) I will try that and report back the results.
        I'm using a DX-4400 from Microtronix.

        1 Reply Last reply
        1
        • M Offline
          M Offline
          Mark81
          wrote on last edited by
          #4
          This post is deleted!
          1 Reply Last reply
          0
          • M Offline
            M Offline
            Mark81
            wrote on last edited by
            #5

            It works! Thanks for the hint.
            Last question: I have to update the values at least 5 times per second (best is 10). Of course the server is in the same LAN of the client. Do you think this is still the right approach?

            I mean, GET requests open and close the socket every time. If I had the availability of a C++ application I could open a TCP socket to be kept open. Do you see any problem to make 5-10 GET request per second continuously?

            1 Reply Last reply
            0
            • Pablo J. RoginaP Offline
              Pablo J. RoginaP Offline
              Pablo J. Rogina
              wrote on last edited by
              #6

              @Mark81 I'm not sure I can help you now regarding performance of repeated requests, but now that you know you can run some javascript on the device, could it be possible you try socket.io for instance by importing a javascript module in QML?

              Upvote the answer(s) that helped you solve the issue
              Use "Topic Tools" button to mark your post as Solved
              Add screenshots via postimage.org
              Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              1
              • M Offline
                M Offline
                Mark81
                wrote on last edited by
                #7

                Of course. I will try that. It was just a thought about, slightly off-topic I have to say. Apologize for that.
                Your hint was very useful indeed. Thanks.

                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