Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Client/Server Architecture of HTTP Communication

Client/Server Architecture of HTTP Communication

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 1.2k 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.
  • M Offline
    M Offline
    maydin
    wrote on last edited by maydin
    #1

    I could not find a better title but I spend days to find good architecture for my program, unfortunately could not invent a good one.

    I have written an API and I have a client. My client application uses both QML and C++. QML is for pages and C++ backend. You may think this as something like Twitter.

    Lets say I am on Page 1. If I click "Open Page 2" these happens:

    • StackView pushes Page2 to stack
    • Page 2 uses C++ function to send request to an API.
    • When response comes, finished signal is emitted that data is ready to read.
    • Related C++ slot emits a signal for QML after handling data.
    • Then QML function populates data to view.

    My problem is that I have to create new signal for each page/request. I don't think this is the right way of implementing this.

    1 Reply Last reply
    0
    • ODБOïO ODБOï

      Hi,
      @maydin said in Client/Server Architecture of HTTP Communication:

      I do not want to make different signal for each page.

      BackEnd::requestPage(int pageNumber)

      note: on your image you wrote 'UML' instead of 'Qml'

      M Offline
      M Offline
      maydin
      wrote on last edited by
      #6

      @LeLev Yeah, it should have been QML.

      @dheerendra I think I should pass a reference to the request function and listen signals depend on their signature.

      1 Reply Last reply
      0
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by dheerendra
        #2

        I am assuming each page is different. So each page need to have signal handler. Backend can be only one object which send the finished signal to page object. This how it should be. What is the individual signal you are talking about ? Is it UI side or backend side ?

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        M 1 Reply Last reply
        2
        • dheerendraD dheerendra

          I am assuming each page is different. So each page need to have signal handler. Backend can be only one object which send the finished signal to page object. This how it should be. What is the individual signal you are talking about ? Is it UI side or backend side ?

          M Offline
          M Offline
          maydin
          wrote on last edited by
          #3

          @dheerendra Yeah, each page need to have a signal handler but I cannot send only one signal to related pages. I created a diagram to explain better.

          In backend class I have different functions and signals for each page. For example

          • Page 1 calls Backend::requestForPage1()
          • It sends function pointer of related slot of page to Network class
          • Callback slot emits responseReadyForPage1.

          I have to create different signal for each page and this is so cumbersome and not optimum way of implementing this.

          Maybe I should send JavaScript function object (aka. signal handler of page) to Backend request function but not sure this is the right way.

          TLDR: @dheerendra said in Client/Server Architecture of HTTP Communication:

          Backend can be only one object which send the finished signal to page object.

          Cannot make only one signal that calls signal handler of page object. I do not want to make different signal for each page.

          0_1548155318557_genel.png

          ODБOïO 1 Reply Last reply
          0
          • M maydin

            @dheerendra Yeah, each page need to have a signal handler but I cannot send only one signal to related pages. I created a diagram to explain better.

            In backend class I have different functions and signals for each page. For example

            • Page 1 calls Backend::requestForPage1()
            • It sends function pointer of related slot of page to Network class
            • Callback slot emits responseReadyForPage1.

            I have to create different signal for each page and this is so cumbersome and not optimum way of implementing this.

            Maybe I should send JavaScript function object (aka. signal handler of page) to Backend request function but not sure this is the right way.

            TLDR: @dheerendra said in Client/Server Architecture of HTTP Communication:

            Backend can be only one object which send the finished signal to page object.

            Cannot make only one signal that calls signal handler of page object. I do not want to make different signal for each page.

            0_1548155318557_genel.png

            ODБOïO Offline
            ODБOïO Offline
            ODБOï
            wrote on last edited by ODБOï
            #4

            Hi,
            @maydin said in Client/Server Architecture of HTTP Communication:

            I do not want to make different signal for each page.

            BackEnd::requestPage(int pageNumber)

            note: on your image you wrote 'UML' instead of 'Qml'

            M 1 Reply Last reply
            0
            • dheerendraD Offline
              dheerendraD Offline
              dheerendra
              Qt Champions 2022
              wrote on last edited by
              #5

              What is the difficulty in making only one signal and passing some reference I'd along with signal to differentiate which page is supposed to process this ?

              Dheerendra
              @Community Service
              Certified Qt Specialist
              http://www.pthinks.com

              1 Reply Last reply
              0
              • ODБOïO ODБOï

                Hi,
                @maydin said in Client/Server Architecture of HTTP Communication:

                I do not want to make different signal for each page.

                BackEnd::requestPage(int pageNumber)

                note: on your image you wrote 'UML' instead of 'Qml'

                M Offline
                M Offline
                maydin
                wrote on last edited by
                #6

                @LeLev Yeah, it should have been QML.

                @dheerendra I think I should pass a reference to the request function and listen signals depend on their signature.

                1 Reply Last reply
                0
                • dheerendraD Offline
                  dheerendraD Offline
                  dheerendra
                  Qt Champions 2022
                  wrote on last edited by dheerendra
                  #7

                  Yes. You can make with request I'd. You can also work with objectname as well. You can move the issue to solved state as well.

                  Dheerendra
                  @Community Service
                  Certified Qt Specialist
                  http://www.pthinks.com

                  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