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. How can i get headers for each connection in QWebSocket.

How can i get headers for each connection in QWebSocket.

Scheduled Pinned Locked Moved Solved General and Desktop
websocketserverwebsocket
4 Posts 2 Posters 2.2k 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.
  • D Offline
    D Offline
    DevelNK
    wrote on 9 Jan 2016, 04:49 last edited by DevelNK 1 Dec 2016, 11:03
    #1

    Sorry for my english.
    I created WebSocket server in QT5. When client is connecting to server, i need get header 'User-Agent'. Since QtWebSocket wrote in QTcpSocket i decide what possibly get all header about QWebSocket connect. But i did not find information about this in documentation.
    Really no way to get request headers from the client during the connection to the QWebSocket server?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 9 Jan 2016, 22:26 last edited by
      #2

      Hi and welcome to devnet,

      QWebSocket is not a QTcpSocket but uses one internally. You can get the request used to establish the connection using QWebSocket::request (only available since 5.6)

      Hope it helps

      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
      1
      • D Offline
        D Offline
        DevelNK
        wrote on 12 Jan 2016, 11:00 last edited by
        #3

        Hi. Thanks for your answer. This is really work. I was recompiled Qt 5.6 beta and tried it.
        Thank you very much.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 12 Jan 2016, 11:11 last edited by
          #4

          You're welcome !

          Since you have what you need now, please mark the thread as solved using the "Topic Tool" button so that other forum members may know a solution has been found :)

          Also, while browsing the forum, consider up-voting answers that helped you. That will make them easier to find for other forum users :)

          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

          4/4

          12 Jan 2016, 11:11

          • Login

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