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

Make QWebSocket::QWebSocket(QTcpSocket...) public

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.11.1, 5.11.3, 5.12.0, 5.13.0 Alpha 1
    • WebSockets
    • None

    Description

      The issue:

      The current websocket implementation in Qt only allow to build a client websocket from the QWebSocket API (with QWebSocket::open()). The only way to create a server websocket is to use the class QWebSocketServer. While this class is a nice way to implement quickly a websocket server, it does not permit to re-use a real http server (3rd party library (as Qt doesn't provide anything for this purpose)) and add a websocket feature to it.

      Currently the only way to achieve this, is to make a QWebSocketServer listen on another port or to use a proxy. This makes the QWebSocket hardly usable with an http server.

      A previous feature request about this has been integrated into Qt 5.9: QTBUG-54276
      The chosen solution was to create the function void QWebSocketServer::handleConnection(QTcpSocket *pTcpSocket)

      However, to me, it is hardly usable since it forces to create an unwanted QWebSocketServer (which won't even listen anything) + we have to let inside the QTcpSocket buffer the hanshake data.

      A solution:

      It would be nice to have an PUBLIC API to "upgrade" a QTcpSocket into a QWebSocket (and this AFTER the http handshake done).
      It almost means making "QWebSocket::QWebSocket(QTcpSocket...)" public.

      Attachments

        Issue Links

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

          Activity

            People

              kurt.pattyn Kurt Pattyn
              enstone Franck Dude
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes