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. When exactly textMessageReceived is emitted
Forum Updated to NodeBB v4.3 + New Features

When exactly textMessageReceived is emitted

Scheduled Pinned Locked Moved Solved QtWebEngine
5 Posts 2 Posters 309 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.
  • P Offline
    P Offline
    Pippin
    wrote last edited by Pippin
    #1

    Hi, quick question.

    A QWebSocket doesn't actually emit the textMessageReceived(const QString&) signal the moment it received a new message, but a few milliseconds later, when the main loop has all connected sockets check for new messages, right?

    If that's what I said, then I don't have anything to do.

    But if Qt is designed to interrupt itself whenever a socket gets a new message, then I'll have to implement a queue system.

    1 Reply Last reply
    1
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote last edited by
      #2

      What do you mean with 'interrupt itself'?
      When qt receveives a new message from the os that there is something to do then it is done. If you block the eventloop then the message can't be handled until the event loop is running again.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2
      • P Offline
        P Offline
        Pippin
        wrote last edited by Pippin
        #3

        Let's suppose I connect the clicked signal of a QPushButton to a slot. I click on it, and for some reason, the slot takes a very long time to finish (let's say there's an infinite loop or whatever). During that time, is it possible for QWebSockets to emit the textMessageReceived signal?

        I'm just trying to understand how many threads are used in total for Qt to work properly. If I understood you correctly, then the textMessageReceived signal(s) would not be emitted until the time-consuming slot has finished its job.

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote last edited by
          #4

          I already answered it: "If you block the eventloop then the message can't be handled until the event loop is running again."
          So no matter where the signal is coming from (OS or different thread) it is not handled until the eventloop is running again.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          1
          • P Pippin has marked this topic as solved
          • P Offline
            P Offline
            Pippin
            wrote last edited by
            #5

            Thank you @Christian-Ehrlicher, it's clear to me now.

            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