Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-62371

WebSockets lose connection after several messages on UWP

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: P2: Important P2: Important
    • None
    • 5.9.1, 5.11.0
    • WebSockets
    • None
    • Windows 10 + Qt 5.9.1 for UWP 64bit (MSVC 2017)

      Windows 10 + Qt 5.9.1 for UWP 32bit (MSVC 2017)
    • WinRT

      Testcase:

      import QtQuick 2.0
      import QtWebSockets 1.0
      
      Item {
        width: 360
        height: 360
        anchors.fill: parent
        WebSocket {
          id: socket
          url: "ws://echo.websocket.org"
          active: true
          onTextMessageReceived:
            messageBox.text = messageBox.text + "\nReceived message: " +
                              (message.length < 10 ? message : message.length)
          onStatusChanged:
            if (socket.status == WebSocket.Error) {
              messageBox.text += "\nError: " + socket.errorString
            } else if (socket.status == WebSocket.Open) {
              messageBox.text += "\nSocket Opened"
            } else if (socket.status == WebSocket.Closed) {
              messageBox.text += "\nSocket closed"
            }
        }
        Timer {
          running: socket.status === WebSocket.Open
          interval: 1000
          repeat: true
          onTriggered: {
            socket.sendTextMessage('One')
            socket.sendTextMessage(new Array(7000).join('x'))
            socket.sendTextMessage('Two')
            socket.sendTextMessage(new Array(7000).join('x'))
          }
        }
        Text {
          id: messageBox
          anchors { bottom: parent.bottom; left: parent.left; right: parent.right }
        }
      }

      The connection gets lost after 2-10 messages, with «Unknown error» in QML and «QIODevice::write (QTcpSocket): device not open» in console.

      The same could be reproduced with other servers, e.g. in my case I was sending only short messages from QML and receiving ~5000 chars messages, and the connection got aborted after 1-3 incoming messages.

      This is perfectly reproduceable, it loses the connection every time after just a few messages.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            owolff Oliver Wolff
            chalker Сковорода Никита
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes