user avatar
QWebSocket: Add 'bytesToWrite'
Mårten Nordheim authored
Add the well-known 'bytesToWrite' function to QWebSocket. Previously
the only way to know how many bytes were left to be written was to
make a guesstimate on the overhead your message would get and then
keep track of the amount sent using the 'bytesWritten' signal.

The tests compare using '>' because there is overhead from the headers.

[ChangeLog][QWebSocket] Added the bytesToWrite function to
QWebSocket. Call this function to see how many bytes are left to write.

Change-Id: I82f17a98b582ee3bc02f0c47597b4a6717761f12
Reviewed-by: default avatarTimur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: default avatarEdward Welbourne <edward.welbourne@qt.io>
bd100e77

Introduction

QtWebSockets is a pure Qt implementation of WebSockets - both client and server. It is implemented as a Qt add-on module, that can easily be embedded into existing Qt projects. It has no other dependencies than Qt.

Features

  • Client and server capable
  • Text and binary sockets
  • Frame-based and message-based signals
  • Strict Unicode checking
  • WSS and proxy support

Requirements

Qt 5.x

Build And Usage

Checkout the source code from code.qt.io Go into the source directory and execute:

qmake
make
make install

The last command will install QtWebSockets as a Qt module.

To use, add websockets to the QT variable.

QT += websockets

Compliance

QtWebSockets is compliant with RFC6455 and has been tested with the Autobahn Testsuite.

Missing Features

  • Extensions and sub-protocols