Important: Please read the Qt Code of Conduct -

How can i get headers for each connection in QWebSocket.

  • 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?

  • Lifetime Qt Champion

    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

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

  • Lifetime Qt Champion

    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 :)

Log in to reply