Home › Forums › kdb+ › Qt QWebSockets with kdb+ › Re: Qt QWebSockets with kdb+
-
Thank you very much for the help, Peter. The issue was indeed that I wasn’t including the Authorization header with the connection.
Initially, I was trying to create my QWebSocket by providing the credentials in the URL like this
QWebSocket m_websocket = new QWebSocket(); m_websocket.open(QUrl(QStringLiteral(“ws://user:pass@host:port”)));
I didn’t realise there is an option to use the open method with a QNetworkRequest which would allow me to add headers to the request. So I changed it to the below and it worked:
QWebSocket m_websocket = new QWebSocket(); QNetworkRequest req(“ws://host:port”); req.setRawHeader(“Authorization”, “Basic <base64 encoded user:pass>”); m_webSocket.open(req);
Thank you very much again for your help.