Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QWebsocket error processing

QWebsocket error processing

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 591 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
    Pavel Romankov
    wrote on last edited by
    #1

    Hello.
    I have a question about brocessing error signal from QWebsocket.
    Now i do like this:

    QObject::connect(&myWebsocket, QOverload<QAbstractSocket::SocketError>::of(&QWebSocket::error),
                     this, [this](QAbstractSocket::SocketError) {
                         qDebug()   << "websocket error : " << myWebsocket.errorString();
                     });
    

    but when i have error with debug string, i have multiply output like this:

    websocket error :  "QWebSocketPrivate::processHandshake: Unhandled http status code: 502 (Bad Gateway\r\n)."
    websocket error :  "Invalid statusline in response: <html>\r\n."
    websocket error :  "Invalid statusline in response: <head><title>502 Bad Gateway</title></head>\r\n."
    websocket error :  "Invalid statusline in response: <body bgcolor=\"white\">\r\n."
    websocket error :  "Invalid statusline in response: <center><h1>502 Bad Gateway</h1></center>\r\n."
    websocket error :  "Invalid statusline in response: <hr><center>nginx/1.10.3</center>\r\n."
    websocket error :  "Invalid statusline in response: </body>\r\n."
    websocket error :  "Invalid statusline in response: </html>\r\n."
    

    what is the right way to ptocess websocket errors?
    in case of error we dont get disconnected signal. If i need to reconnect socket i need to initiate socket closing and reconnecting from error process handler (in my case from lambda)?

    Pablo J. RoginaP 1 Reply Last reply
    0
    • P Pavel Romankov

      Hello.
      I have a question about brocessing error signal from QWebsocket.
      Now i do like this:

      QObject::connect(&myWebsocket, QOverload<QAbstractSocket::SocketError>::of(&QWebSocket::error),
                       this, [this](QAbstractSocket::SocketError) {
                           qDebug()   << "websocket error : " << myWebsocket.errorString();
                       });
      

      but when i have error with debug string, i have multiply output like this:

      websocket error :  "QWebSocketPrivate::processHandshake: Unhandled http status code: 502 (Bad Gateway\r\n)."
      websocket error :  "Invalid statusline in response: <html>\r\n."
      websocket error :  "Invalid statusline in response: <head><title>502 Bad Gateway</title></head>\r\n."
      websocket error :  "Invalid statusline in response: <body bgcolor=\"white\">\r\n."
      websocket error :  "Invalid statusline in response: <center><h1>502 Bad Gateway</h1></center>\r\n."
      websocket error :  "Invalid statusline in response: <hr><center>nginx/1.10.3</center>\r\n."
      websocket error :  "Invalid statusline in response: </body>\r\n."
      websocket error :  "Invalid statusline in response: </html>\r\n."
      

      what is the right way to ptocess websocket errors?
      in case of error we dont get disconnected signal. If i need to reconnect socket i need to initiate socket closing and reconnecting from error process handler (in my case from lambda)?

      Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #2

      @Pavel-Romankov said in QWebsocket error processing:

      <hr><center>nginx/1.10.3<

      It looks like you're connecting to a Nginx server.
      Are you sure such installation is providing a Websocket server as well?
      You may want to look at this documentation.

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Pavel Romankov
        wrote on last edited by
        #3

        yes, i connect to Nginx server. I get this error from Nginx when backend server isn't running.

        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