Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QWebSocket for some reason wont work on android but works fine on Windows
Forum Updated to NodeBB v4.3 + New Features

QWebSocket for some reason wont work on android but works fine on Windows

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
4 Posts 2 Posters 308 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.
  • K Offline
    K Offline
    Kris Revi
    wrote on last edited by
    #1

    i've setup this

        connect(&m_webSocket, QOverload<QAbstractSocket::SocketError>::of(&QWebSocket::error),
                [=](QAbstractSocket::SocketError error){ qDebug() << "Websocket ERROR : " << m_webSocket.errorString(); });
    

    and get this

    [SOCKET][INFO] We are closing the connection
    Websocket ERROR :  "Socket is not connected"
    

    even printing the "error" gives

    QAbstractSocket::UnknownSocketError
    

    code im using to connect to server

    void MainWindow::connectTo(QString selected_board)
    {
        _socket.doConnect(QStringLiteral("ws://%1:80").arg(selected_board));
    }
    
    1 Reply Last reply
    0
    • K Offline
      K Offline
      Kris Revi
      wrote on last edited by
      #2

      doing a google search gives me nothing aswell as the error message itself does not give me any clues :/

      the AndroidManufest.xml has INTERNET permission set :S
      0f1264c7-cca0-4397-affe-741e05235388-image.png

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Kris Revi
        wrote on last edited by
        #3

        wait.... i just found the problem....

        this line

        #if defined(Q_OS_ANDROID)
          QScroller::grabGesture(ui->scrollAreaPaletteContent, QScroller::LeftMouseButtonGesture);
        #endif
        

        made QWebsocket not work....... wait what!!!

        i commented that line out and socket works on my android tablet now :S
        if i uncomment it then socket dont work no more :S

        i a super confused!

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          This one looks pretty strange indeed.

          Does the disconnection happen when you use the gesture or just having it enabled does that as well ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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