From 595551b06d971fe6a01c08b0779b531d054c47f9 Mon Sep 17 00:00:00 2001 From: Kurt Pattyn Date: Sat, 25 Jan 2014 14:48:20 +0100 Subject: Update documentation Clarified which versions are supported and that subprotocols and extensions are not supported. Fixed some typos. Change-Id: I99ef2fbbf74c287bea7d1b7a07881bf0542135ff Reviewed-by: Frederik Gladhorn --- src/websockets/qwebsocket.cpp | 6 ++++++ src/websockets/qwebsocketframe.cpp | 2 +- src/websockets/qwebsocketprotocol.cpp | 13 ++++++++++--- src/websockets/qwebsocketserver.cpp | 13 +++++++++++-- 4 files changed, 28 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/websockets/qwebsocket.cpp b/src/websockets/qwebsocket.cpp index 40b9da1..17bd364 100644 --- a/src/websockets/qwebsocket.cpp +++ b/src/websockets/qwebsocket.cpp @@ -53,6 +53,12 @@ This class was modeled after QAbstractSocket. + QWebSocket currently does not support + \l {http://tools.ietf.org/html/rfc6455#page-39} {extensions} and + \l {http://tools.ietf.org/html/rfc6455#page-12} {subprotocols}. + + QWebSocket only supports version 13 of the WebSocket protocol, as outlined in RFC 6455. + \sa QAbstractSocket, QTcpSocket \sa {QWebSocket client example} diff --git a/src/websockets/qwebsocketframe.cpp b/src/websockets/qwebsocketframe.cpp index f5a4787..1f6e3da 100644 --- a/src/websockets/qwebsocketframe.cpp +++ b/src/websockets/qwebsocketframe.cpp @@ -51,7 +51,7 @@ It processes frames one at a time. \note It is the QWebSocketDataProcessor that takes the sequence into account. - \sa DataProcessor() + \sa QWebSocketDataProcessor \internal */ diff --git a/src/websockets/qwebsocketprotocol.cpp b/src/websockets/qwebsocketprotocol.cpp index efcc313..01178ad 100644 --- a/src/websockets/qwebsocketprotocol.cpp +++ b/src/websockets/qwebsocketprotocol.cpp @@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE \value CloseCodeTooMuchData Message too big \value CloseCodeMissingExtension Mandatory extension missing \value CloseCodeBadOperation Internal server error - \value CloseCodeHandshakeFailed TLS handshake failed + \value CloseCodeTlsHandshakeFailed TLS handshake failed \sa QWebSocket::close() */ @@ -85,37 +85,44 @@ QT_BEGIN_NAMESPACE For an overview of the differences between the different protocols, see - \value VersionUnknow Unknown or unspecified version. + \value VersionUnknown Unknown or unspecified version. \value Version0 hixie76: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76 & hybi-00: http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-00. Works with key1, key2 and a key in the payload. Attribute: Sec-WebSocket-Draft value 0. + Not supported by QtWebSockets. \value Version4 hybi-04: http://tools.ietf.org/id/draft-ietf-hybi-thewebsocketprotocol-04.txt. Changed handshake: key1, key2, key3 ==> Sec-WebSocket-Key, Sec-WebSocket-Nonce, Sec-WebSocket-Accept Sec-WebSocket-Draft renamed to Sec-WebSocket-Version Sec-WebSocket-Version = 4. + Not supported by QtWebSockets. \value Version5 hybi-05: http://tools.ietf.org/id/draft-ietf-hybi-thewebsocketprotocol-05.txt. Sec-WebSocket-Version = 5 Removed Sec-WebSocket-Nonce Added Sec-WebSocket-Accept. + Not supported by QtWebSockets. \value Version6 Sec-WebSocket-Version = 6. + Not supported by QtWebSockets. \value Version7 hybi-07: http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-07. Sec-WebSocket-Version = 7. + Not supported by QtWebSockets. \value Version8 hybi-8, hybi-9, hybi-10, hybi-11 and hybi-12. Status codes 1005 and 1006 are added and all codes are now unsigned Internal error results in 1006. + Not supported by QtWebSockets. \value Version13 hybi-13, hybi14, hybi-15, hybi-16, hybi-17 and RFC 6455. Sec-WebSocket-Version = 13 Status code 1004 is now reserved Added 1008, 1009 and 1010 Must support TLS - Clarify multiple version suppor.t + Clarify multiple version support. + Supported by QtWebSockets. \value VersionLatest Refers to the latest known version to QtWebSockets. */ diff --git a/src/websockets/qwebsocketserver.cpp b/src/websockets/qwebsocketserver.cpp index e52a539..30ff88d 100644 --- a/src/websockets/qwebsocketserver.cpp +++ b/src/websockets/qwebsocketserver.cpp @@ -57,12 +57,21 @@ Call nextPendingConnection() to accept the pending connection as a connected QWebSocket. The function returns a pointer to a QWebSocket in QAbstractSocket::ConnectedState that you can use for communicating with the client. + If an error occurs, serverError() returns the type of error, and errorString() can be called to get a human readable description of what happened. + When listening for connections, the address and port on which the server is listening are available as serverAddress() and serverPort(). + Calling close() makes QWebSocketServer stop listening for incoming connections. + QWebSocketServer currently does not support + \l {http://tools.ietf.org/html/rfc6455#page-39} {extensions} and + \l {http://tools.ietf.org/html/rfc6455#page-12} {subprotocols}. + + QWebSocketServer only supports version 13 of the WebSocket protocol, as outlined in RFC 6455. + \sa echoserver.html \sa QWebSocket @@ -94,7 +103,7 @@ \snippet echoserver/echoserver.cpp processTextMessage Whenever `processTextMessage()` is triggered, we retrieve the sender, and if valid, send back the - original message (`send()`). + original message (`sendTextMessage()`). The same is done with binary messages. \snippet echoserver/echoserver.cpp processBinaryMessage The only difference is that the message now is a QByteArray instead of a QString. @@ -204,7 +213,7 @@ QT_BEGIN_NAMESPACE /*! - Constructs a new WebSocketServer with the given \a serverName. + Constructs a new QWebSocketServer with the given \a serverName. The \a serverName will be used in the http handshake phase to identify the server. The \a secureMode parameter indicates whether the server operates over wss (\l{SecureMode}) or over ws (\l{NonSecureMode}). -- cgit v1.2.3