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. QWebEngine communcation from a Websocket on a WebWorker
Forum Updated to NodeBB v4.3 + New Features

QWebEngine communcation from a Websocket on a WebWorker

Scheduled Pinned Locked Moved Solved QtWebEngine
4 Posts 2 Posters 903 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.
  • S Offline
    S Offline
    steno
    wrote on last edited by
    #1

    I'm using QWebEngineView in conjuction with QWebChannel to communicate between JS to C++. I'm trying to figure out a way to communicate directly from a WebWorker to the under lying QWebChannel. I really don't want to post a message to the main JS context to then post a message to the QWebChannel. Is there a way to bypass the middle man?

    I did try using a WebSocket and QWebSocketServer, but the websocket never seems to finish connecting.

    eyllanescE 1 Reply Last reply
    0
    • S steno

      @eyllanesc Yes WebSockets in Webworkers are supported in Chromium 89 which Qt 5.15.5 is targeting.

      eyllanescE Offline
      eyllanescE Offline
      eyllanesc
      wrote on last edited by eyllanesc
      #4

      @steno If so, then implement the logic that is inside window.onload from the official example: https://code.qt.io/cgit/qt/qtwebchannel.git/tree/examples/webchannel/chatclient-html/chatclient.html?h=5.15#n21 in the WebWorker.

      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

      1 Reply Last reply
      1
      • S steno

        I'm using QWebEngineView in conjuction with QWebChannel to communicate between JS to C++. I'm trying to figure out a way to communicate directly from a WebWorker to the under lying QWebChannel. I really don't want to post a message to the main JS context to then post a message to the QWebChannel. Is there a way to bypass the middle man?

        I did try using a WebSocket and QWebSocketServer, but the websocket never seems to finish connecting.

        eyllanescE Offline
        eyllanescE Offline
        eyllanesc
        wrote on last edited by
        #2

        @steno QtWebChannel is simply a code that sends information through websockets where objects are encoded and decoded. Since I don't know much about WebWorker it couldn't help you much but if you can run a websocket in a WebWorker then you can easily start qwebchannel in the WebWorker. Can websockets run on WebWorker?

        If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          steno
          wrote on last edited by steno
          #3

          @eyllanesc Yes WebSockets in Webworkers are supported in Chromium 89 which Qt 5.15.5 is targeting.

          eyllanescE 1 Reply Last reply
          0
          • S steno

            @eyllanesc Yes WebSockets in Webworkers are supported in Chromium 89 which Qt 5.15.5 is targeting.

            eyllanescE Offline
            eyllanescE Offline
            eyllanesc
            wrote on last edited by eyllanesc
            #4

            @steno If so, then implement the logic that is inside window.onload from the official example: https://code.qt.io/cgit/qt/qtwebchannel.git/tree/examples/webchannel/chatclient-html/chatclient.html?h=5.15#n21 in the WebWorker.

            If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

            1 Reply Last reply
            1

            • Login

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