Qt World Summit: Register Today!

[Solved] WebSocket client

  • Hello everybody,
    I am developing application that need to communicate with remote server via websockets. I was looking for some websocket client implementations and I have found "QtWebSockets":https://github.com/ant-lafarge/QtWebsocket. I was trying to connect to localhost python server on port 8888, or to echo.websocket.org on port 80. But it doesn't seem to work, I am getting QAbstractSocket::ConnectionRefusedError and QAbstractSocket::RemoteHostClosedError. I know that localhost server is running ok - I have created simple html page with JavaScript and it works. Has anybody some experience with this? Is this client ment only for communication with QWsServer?

  • I found out what was wrong.
    Masking in QtWebsocket was commented out. My server was ignoring frames and closing connection since frames were not masked. Removed comments and it seem to work fine.

  • Maybe this can be of interest to you. I have just open-sourced a WebSockets implementation (see "QWebSockets":https://github.com/KurtPattyn/QWebSockets).
    The only dependency is Qt.
    The implementation has been tested against the Autobahn test suite, and except for non-character Unicode code points, all tests pass. Performance is also great; e.g. it is faster than any available browser.

Log in to reply