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. Two major problem that prevent QT webassembly used in real project.

Two major problem that prevent QT webassembly used in real project.

Scheduled Pinned Locked Moved Unsolved Qt for WebAssembly
11 Posts 5 Posters 3.0k 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.
  • W Offline
    W Offline
    wenqing zhong
    wrote on 30 Jun 2022, 14:30 last edited by
    #1
    1. Websocket doesn’t support SSL
      I am senior in software development but new to QT. The QT feature of support multi-platform attract me, and I move my project into QT recently. The transplanting procedure in App for windows/linux is very good as expected. But the qt webassembly part is not so smoothly.
      In order to support all the win/linux/web clients, I re-construct the data provider structure, use websocket(wss and ws) for all platforms. At beginning, my server use wss only, but when I found that Qt wasm cannot use ssl, I add ws support in the server. I use emrun to test and run the wasm project, everything look like ok, but when the project process nearly to the end. I try to deploy to the real product environment, I found I fall in a logical trap.
      I configure a apache2.4 http server use http to run my qt wasm project. It can only access in 127.0.0.1 loopback interface. If I use real IP to open it, web browser prompt:
      ===
      ReferenceError: SharedArrayBuffer is not defined
      ===
      I check network and find its COEP problem, I force http server provide COEP header but it still didn’t work. At last I found in chrome debug information, that the browser igore COEP head if it’s not a https request. Then I configure apache httpserver with https. It work, but when the qt websocket connect to my server, web brower prompt:

    VM70:7 Mixed Content: The page at 'https://10.168.2.80/gncscada.html' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://10.168.2.80:6113/'. This request has been blocked; this endpoint must be available over WSS.

    I don’t know how to express my disappointment. I try microsoft edge and chrome, get the same result.
    Today, all the browser require safety, so the qt websocket without ssl is useless in wasm.
    For now, I can only try the websocket provide by emscripten to replace qt websocket.

    1. Qt wasm cannot input chinese.
      The websocket problem, I still can try other option. But this one, I have no idea how to solve it.
      Below is a screen snapshot of my wasm project. I can input “admin”, but the following two chinese word, I cannot input it. For now I can only open a notepad, input chinese words, copy/paste to there.
      I think not only chinese, other multibyte language will face to the same problem.
      图片1.png
    1 Reply Last reply
    0
    • J Offline
      J Offline
      JoeCFD
      wrote on 30 Jun 2022, 15:00 last edited by
      #2

      which Qt version is used in your project?
      you can file bugs here https://bugreports.qt.io/secure/Dashboard.jspa

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JoeCFD
        wrote on 30 Jun 2022, 15:05 last edited by
        #3

        @wenqing-zhong said in Two major problem that prevent QT webassembly used in real project.:

        Qt wasm

        https://stackoverflow.com/questions/63016067/build-qt-from-source-so-that-it-accepts-chinese-input

        W 1 Reply Last reply 3 Jul 2022, 02:34
        0
        • L Offline
          L Offline
          lorn.potter
          wrote on 2 Jul 2022, 21:38 last edited by lorn.potter 7 Feb 2022, 21:55
          #4

          Hi,

          1. Use must use https for accessing threads which use javascript SharedArrayBuffer. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements

          Qt Webassembly QNAM (QNetworkAccessManager) will access secure websockets (wss), just use https in the url. Also QWebSockets. If you need to use a custom certificate, you need to add it to the browser's certificates.

          1. This is fixed in 6.4 and 6.3 (or should be). See https://codereview.qt-project.org/c/qt/qtbase/+/416609
            If this doesn't fix it completely, then please open a new bug report. https://bugreports.qt.io/secure/Dashboard.jspa

          Freelance Software Engineer, Platform Maintainer QtWebAssembly, Maintainer QtSensors
          Author, Hands-On Mobile and Embedded Development with Qt 5 http://bit.ly/HandsOnMobileEmbedded

          W D 2 Replies Last reply 3 Jul 2022, 02:43
          1
          • J JoeCFD
            30 Jun 2022, 15:05

            @wenqing-zhong said in Two major problem that prevent QT webassembly used in real project.:

            Qt wasm

            https://stackoverflow.com/questions/63016067/build-qt-from-source-so-that-it-accepts-chinese-input

            W Offline
            W Offline
            wenqing zhong
            wrote on 3 Jul 2022, 02:34 last edited by
            #5

            @JoeCFD
            I think that is not the problem I met, but thanks for your reply anyway. Below Mr lorn.potter's reply said my question will be solved soon.

            1 Reply Last reply
            0
            • L lorn.potter
              2 Jul 2022, 21:38

              Hi,

              1. Use must use https for accessing threads which use javascript SharedArrayBuffer. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements

              Qt Webassembly QNAM (QNetworkAccessManager) will access secure websockets (wss), just use https in the url. Also QWebSockets. If you need to use a custom certificate, you need to add it to the browser's certificates.

              1. This is fixed in 6.4 and 6.3 (or should be). See https://codereview.qt-project.org/c/qt/qtbase/+/416609
                If this doesn't fix it completely, then please open a new bug report. https://bugreports.qt.io/secure/Dashboard.jspa
              W Offline
              W Offline
              wenqing zhong
              wrote on 3 Jul 2022, 02:43 last edited by
              #6

              @lorn-potter
              Thanks a lot. It's good news to hear that input bug will be solved soon.
              About the QWebsocket, I haven't use QNetworkAccessManager because I don't use http get/post operation, I will try to research more about it. I am just using QWebSocket::sendTextMessage(sendmsg) to send request to server, and use QWebSocket::textMessageReceived(QString) signal to receive the reply from server.

              1 Reply Last reply
              0
              • L lorn.potter
                2 Jul 2022, 21:38

                Hi,

                1. Use must use https for accessing threads which use javascript SharedArrayBuffer. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements

                Qt Webassembly QNAM (QNetworkAccessManager) will access secure websockets (wss), just use https in the url. Also QWebSockets. If you need to use a custom certificate, you need to add it to the browser's certificates.

                1. This is fixed in 6.4 and 6.3 (or should be). See https://codereview.qt-project.org/c/qt/qtbase/+/416609
                  If this doesn't fix it completely, then please open a new bug report. https://bugreports.qt.io/secure/Dashboard.jspa
                D Offline
                D Offline
                DemonCat
                wrote on 15 Feb 2023, 08:57 last edited by
                #7

                @lorn-potter I tried 6.4.2 and 6.5.0 Beat2 and still couldn't enter Chinese

                1 Reply Last reply
                0
                • Z Offline
                  Z Offline
                  zhong wenqing
                  wrote on 16 Mar 2023, 15:37 last edited by
                  #8

                  @lorn-potter
                  Hi, several monthes passed after I open an issue QTBUG-107139, but haven't found progress. Which version will this problem be solved?

                  L 1 Reply Last reply 16 Mar 2023, 19:27
                  0
                  • Z zhong wenqing
                    16 Mar 2023, 15:37

                    @lorn-potter
                    Hi, several monthes passed after I open an issue QTBUG-107139, but haven't found progress. Which version will this problem be solved?

                    L Offline
                    L Offline
                    lorn.potter
                    wrote on 16 Mar 2023, 19:27 last edited by
                    #9

                    @zhong-wenqing
                    The patch
                    https://codereview.qt-project.org/c/qt/qtbase/+/436295

                    is still in review. I will bump it to the reviewers again.

                    Freelance Software Engineer, Platform Maintainer QtWebAssembly, Maintainer QtSensors
                    Author, Hands-On Mobile and Embedded Development with Qt 5 http://bit.ly/HandsOnMobileEmbedded

                    Z 1 Reply Last reply 23 Mar 2023, 11:33
                    1
                    • L lorn.potter
                      16 Mar 2023, 19:27

                      @zhong-wenqing
                      The patch
                      https://codereview.qt-project.org/c/qt/qtbase/+/436295

                      is still in review. I will bump it to the reviewers again.

                      Z Offline
                      Z Offline
                      zhong wenqing
                      wrote on 23 Mar 2023, 11:33 last edited by
                      #10

                      @lorn-potter Thanks, the qt-bug system inform me today, this patch is merged into Qt6.6. I will try it.

                      1 Reply Last reply
                      0
                      • P pgmQt referenced this topic on 14 May 2023, 22:03
                      • Z ZoltanKovacs referenced this topic on 14 Jul 2023, 16:10
                      • Z Offline
                        Z Offline
                        zhong wenqing
                        wrote on 28 Sept 2023, 05:05 last edited by
                        #11

                        @lorn.potter Hi, Is this issue very difficult to resolved? or not important? the new released versions all have this problem.

                        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