From c481daa1899ebffe6d7d3805fd503aa8d29ad715 Mon Sep 17 00:00:00 2001 From: Kurt Pattyn Date: Sun, 22 Dec 2013 17:15:51 +0100 Subject: [PATCH] Add extra documentation Change-Id: I1a3c0571faeabf2d05bc144628d186e5ff039014 Reviewed-by: Kurt Pattyn --- examples/doc/echoclient.qdoc | 49 ++++++++++++++++++ examples/doc/echoserver.qdoc | 51 +++++++++++++++++++ examples/doc/qmlwebsocketclient.qdoc | 46 +++++++++++++++++ examples/doc/simplechat.qdoc | 49 ++++++++++++++++++ examples/doc/sslechoclient.qdoc | 51 +++++++++++++++++++ examples/doc/sslechoserver.qdoc | 51 +++++++++++++++++++ examples/examples.qdoc | 59 ++++++++++++++++++++++ src/imports/qmlwebsockets/qqmlwebsocket.cpp | 17 +++++++ src/websockets/doc/qtwebsockets.qdocconfig | 12 +++-- .../doc/snippets/src_websockets_ssl_qwebsocket.cpp | 10 ++++ src/websockets/qwebsocket.cpp | 10 ++-- src/websockets/qwebsocketcorsauthenticator.cpp | 18 +++++-- src/websockets/qwebsocketserver.cpp | 48 ++++++++++++++++-- src/websockets/websockets.pro | 1 + 14 files changed, 458 insertions(+), 14 deletions(-) create mode 100644 examples/doc/echoclient.qdoc create mode 100644 examples/doc/echoserver.qdoc create mode 100644 examples/doc/qmlwebsocketclient.qdoc create mode 100644 examples/doc/simplechat.qdoc create mode 100644 examples/doc/sslechoclient.qdoc create mode 100644 examples/doc/sslechoserver.qdoc create mode 100644 examples/examples.qdoc diff --git a/examples/doc/echoclient.qdoc b/examples/doc/echoclient.qdoc new file mode 100644 index 0000000..a1f1646 --- /dev/null +++ b/examples/doc/echoclient.qdoc @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWebSockets module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example echoclient + \title Echo Client Example + \ingroup qtwebsockets-examples + \brief Explains how to use the websocket API to create a simple echo client. + + \sa {Echo Server Example} +*/ diff --git a/examples/doc/echoserver.qdoc b/examples/doc/echoserver.qdoc new file mode 100644 index 0000000..b7b8299 --- /dev/null +++ b/examples/doc/echoserver.qdoc @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWebSockets module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example echoserver + \title Echo Server Example + \ingroup qtwebsockets-examples + + The Echo Server example shows how to create a simple server application that + sends back the messages that it receives, using the websockets API. + + \sa {Echo Client Example} +*/ diff --git a/examples/doc/qmlwebsocketclient.qdoc b/examples/doc/qmlwebsocketclient.qdoc new file mode 100644 index 0000000..0bf39bd --- /dev/null +++ b/examples/doc/qmlwebsocketclient.qdoc @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWebSockets module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example qmlwebsocketclient + \title QML WebSocket Client Example + \ingroup qtwebsockets-examples +*/ diff --git a/examples/doc/simplechat.qdoc b/examples/doc/simplechat.qdoc new file mode 100644 index 0000000..215c46a --- /dev/null +++ b/examples/doc/simplechat.qdoc @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWebSockets module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example simplechat + \title Simple Chat Example + \ingroup qtwebsockets-examples + + The Simple Chat example shows how to use the QWebSocket and QWebSocketServer + classes to create a minimalistic chat application over websockets. +*/ diff --git a/examples/doc/sslechoclient.qdoc b/examples/doc/sslechoclient.qdoc new file mode 100644 index 0000000..ca515ec --- /dev/null +++ b/examples/doc/sslechoclient.qdoc @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWebSockets module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example sslechoclient + \title SSL Echo Client Example + \ingroup qtwebsockets-examples + + The SSL Echo Client example shows how to use the QWebSocket class to implement + an echo client over a secure connection (wss). + + \sa {Echo Client Example}, {SSL Echo Server Example} +*/ diff --git a/examples/doc/sslechoserver.qdoc b/examples/doc/sslechoserver.qdoc new file mode 100644 index 0000000..608b27a --- /dev/null +++ b/examples/doc/sslechoserver.qdoc @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWebSockets module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example sslechoserver + \title SSL Echo Server Example + \ingroup qtwebsockets-examples + + The SSL Echo Server example shows how to use the QWebSocketServer class + to implement a simple echo server over secure sockets (wss). + + \sa {SSL Echo Client Example}, {Echo Server Example} +*/ diff --git a/examples/examples.qdoc b/examples/examples.qdoc new file mode 100644 index 0000000..b770704 --- /dev/null +++ b/examples/examples.qdoc @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWebSockets module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +/*! + \title Qt WebSockets Examples + \page examples.html + \brief List of Qt WebSocket examples + + The module provides the following examples for reference to + help understand the API usage: + + \list + \li \l echoclient + \li \l echoserver + \li \l qmlwebsocketclient + \li \l simplechat + \li \l sslechoclient + \li \l sslechoserver + \endlist +*/ diff --git a/src/imports/qmlwebsockets/qqmlwebsocket.cpp b/src/imports/qmlwebsockets/qqmlwebsocket.cpp index 49b1dfd..9d2ce7f 100644 --- a/src/imports/qmlwebsockets/qqmlwebsocket.cpp +++ b/src/imports/qmlwebsockets/qqmlwebsocket.cpp @@ -39,6 +39,23 @@ ** ****************************************************************************/ +/*! + \qmltype WebSocket + \instantiates QQmlWebSocket + + \inqmlmodule Qt.WebSockets + \brief QML interface to QWebSocket. + + WebSockets is a web technology providing full-duplex communications channels over a single TCP connection. + The WebSocket protocol was standardized by the IETF as RFC 6455 in 2011 (see http://tools.ietf.org/html/rfc6455). +*/ + +/*! + \qmlproperty url QQmlWebSocket::url + Server url to connect to. The url must have one of 2 schemes: {ws://} or {wss://}. + When not supplied, then {ws://} is used. + */ + #include "qqmlwebsocket.h" #include diff --git a/src/websockets/doc/qtwebsockets.qdocconfig b/src/websockets/doc/qtwebsockets.qdocconfig index 0e57238..83e995f 100644 --- a/src/websockets/doc/qtwebsockets.qdocconfig +++ b/src/websockets/doc/qtwebsockets.qdocconfig @@ -19,12 +19,17 @@ qhp.QtWebSockets.filterAttributes = qtwebsockets $QT_VERSION q qhp.QtWebSockets.customFilters.Qt.name = QtWebSockets $QT_VERSION qhp.QtWebSockets.customFilters.Qt.filterAttributes = qtwebsockets $QT_VERSION -qhp.QtWebSockets.subprojects = classes +qhp.QtWebSockets.subprojects = classes examples qhp.QtWebSockets.subprojects.classes.title = C++ Classes qhp.QtWebSockets.subprojects.classes.indexTitle = Qt WebSockets C++ Classes qhp.QtWebSockets.subprojects.classes.selectors = class fake:headerfile qhp.QtWebSockets.subprojects.classes.sortPages = true +#qhp.QtWebSockets.subprojects.examples.title = Examples +#qhp.QtWebSockets.subprojects.examples.indexTitle = Qt WebSockets Examples +#qhp.QtWebSockets.subprojects.examples.selectors = class fake:example +#qhp.QtWebSockets.subprojects.examples.sortPages = true + tagfile = ../../../doc/qtwebsockets/qtwebsockets.tags @@ -32,10 +37,11 @@ depends += qtcore qtnetwork qtdoc headerdirs += .. -sourcedirs += .. +sourcedirs += .. \ + src exampledirs += ../../../examples/ \ -snippets + snippets navigation.landingpage = "Qt WebSockets" navigation.cppclassespage = "Qt WebSockets C++ Classes" diff --git a/src/websockets/doc/snippets/src_websockets_ssl_qwebsocket.cpp b/src/websockets/doc/snippets/src_websockets_ssl_qwebsocket.cpp index 602ae8f..0661d1c 100644 --- a/src/websockets/doc/snippets/src_websockets_ssl_qwebsocket.cpp +++ b/src/websockets/doc/snippets/src_websockets_ssl_qwebsocket.cpp @@ -24,3 +24,13 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +//! [6] +QList cert = QSslCertificate::fromPath(QLatin1String("server-certificate.pem")); +QSslError error(QSslError::SelfSignedCertificate, cert.at(0)); +QList expectedSslErrors; +expectedSslErrors.append(error); + +QWebSocket socket; +socket.ignoreSslErrors(expectedSslErrors); +socket.open("wss://myserver.at.home"); +//! [6] diff --git a/src/websockets/qwebsocket.cpp b/src/websockets/qwebsocket.cpp index d8378b4..3c1c71f 100644 --- a/src/websockets/qwebsocket.cpp +++ b/src/websockets/qwebsocket.cpp @@ -46,14 +46,14 @@ \brief Implements a TCP socket that talks the websocket protocol. WebSockets is a web technology providing full-duplex communications channels over a single TCP connection. - The WebSocket protocol was standardized by the IETF as RFC 6455 in 2011 (see http://tools.ietf.org/html/rfc6455). + The WebSocket protocol was standardized by the IETF as \l {http://tools.ietf.org/html/rfc6455} {RFC 6455} in 2011. It can both be used in a client application and server application. This class was modeled after QAbstractSocket. \sa QAbstractSocket, QTcpSocket - \sa echoclient.html + \sa {QWebSocket client example} */ /*! @@ -226,9 +226,9 @@ QT_BEGIN_NAMESPACE /*! * \brief Creates a new QWebSocket with the given \a origin, the \a version of the protocol to use and \a parent. * - * The \a origin of the client is as specified in http://tools.ietf.org/html/rfc6454. - * (The \a origin is not required for non-web browser clients (see RFC 6455)). - * \note Currently only V13 (RFC 6455) is supported + * The \a origin of the client is as specified \l {http://tools.ietf.org/html/rfc6454} {RFC 6454}. + * (The \a origin is not required for non-web browser clients (see \l {http://tools.ietf.org/html/rfc6455} {RFC 6455})). + * \note Currently only V13 (\l {http://tools.ietf.org/html/rfc6455} {RFC 6455}) is supported */ QWebSocket::QWebSocket(const QString &origin, QWebSocketProtocol::Version version, QObject *parent) : QObject(parent), diff --git a/src/websockets/qwebsocketcorsauthenticator.cpp b/src/websockets/qwebsocketcorsauthenticator.cpp index f43447f..af9f5a1 100644 --- a/src/websockets/qwebsocketcorsauthenticator.cpp +++ b/src/websockets/qwebsocketcorsauthenticator.cpp @@ -74,7 +74,7 @@ QWebSocketCorsAuthenticatorPrivate::QWebSocketCorsAuthenticatorPrivate(const QSt {} /*! - \internal + Destroys the object. */ QWebSocketCorsAuthenticatorPrivate::~QWebSocketCorsAuthenticatorPrivate() {} @@ -89,14 +89,14 @@ QWebSocketCorsAuthenticator::QWebSocketCorsAuthenticator(const QString &origin) } /*! - Destructs the object + Destroys the object */ QWebSocketCorsAuthenticator::~QWebSocketCorsAuthenticator() { } /*! - Constructs a coy of \a other + Constructs a copy of \a other */ QWebSocketCorsAuthenticator::QWebSocketCorsAuthenticator(const QWebSocketCorsAuthenticator &other) : d_ptr(new QWebSocketCorsAuthenticatorPrivate(other.d_ptr->m_origin, other.d_ptr->m_isAllowed)) @@ -118,10 +118,17 @@ QWebSocketCorsAuthenticator &QWebSocketCorsAuthenticator::operator =(const QWebS } #ifdef Q_COMPILER_RVALUE_REFS +/*! + Move-constructs a QWebSocketCorsAuthenticator, making it point at the same + object \a other was pointing to. + */ QWebSocketCorsAuthenticator::QWebSocketCorsAuthenticator(QWebSocketCorsAuthenticator &&other) : d_ptr(other.d_ptr.take()) {} +/*! + Move-assigns \a other to this instance. + */ QWebSocketCorsAuthenticator &QWebSocketCorsAuthenticator::operator =(QWebSocketCorsAuthenticator &&other) { qSwap(d_ptr, other.d_ptr); @@ -130,6 +137,11 @@ QWebSocketCorsAuthenticator &QWebSocketCorsAuthenticator::operator =(QWebSocketC #endif +/*! + Swaps \a other with this authenticator. + + This operation is very fast and never fails. + */ void QWebSocketCorsAuthenticator::swap(QWebSocketCorsAuthenticator &other) { if (&other != this) { diff --git a/src/websockets/qwebsocketserver.cpp b/src/websockets/qwebsocketserver.cpp index 3198c13..b20e2f6 100644 --- a/src/websockets/qwebsocketserver.cpp +++ b/src/websockets/qwebsocketserver.cpp @@ -103,7 +103,7 @@ */ /*! - \fn void QWebSocketServer::serverError(QNetworkProtocol::CloseCode closeCode) + \fn void QWebSocketServer::serverError(QWebSocketProtocol::CloseCode closeCode) This signal is emitted when an error occurs during the setup of a web socket connection. The \a closeCode parameter describes the type of error that occurred @@ -136,6 +136,47 @@ this signal, as the connection will always succeed. */ +/*! + \fn void QWebSocketServer::peerVerifyError(const QSslError &error) + + QWebSocketServer can emit this signal several times during the SSL handshake, + before encryption has been established, to indicate that an error has + occurred while establishing the identity of the peer. The \a error is + usually an indication that QWebSocketServer is unable to securely identify the + peer. + + This signal provides you with an early indication when something's wrong. + By connecting to this signal, you can manually choose to tear down the + connection from inside the connected slot before the handshake has + completed. If no action is taken, QWebSocketServer will proceed to emitting + QWebSocketServer::sslErrors(). + + \sa sslErrors() +*/ + +/*! + \fn void QWebSocketServer::sslErrors(const QList &errors) + + QWebSocketServer emits this signal after the SSL handshake to indicate that one + or more errors have occurred while establishing the identity of the + peer. The errors are usually an indication that QWebSocketServer is unable to + securely identify the peer. Unless any action is taken, the connection + will be dropped after this signal has been emitted. + + \a errors contains one or more errors that prevent QSslSocket from + verifying the identity of the peer. + + \sa peerVerifyError() +*/ + +/*! + \enum QWebSocketServer::SecureMode + Indicates whether the server operates over wss (SECURE_MODE) or ws (NON_SECURE_MODE) + + \value SECURE_MODE The server operates in secure mode (over wss) + \value NON_SECURE_MODE The server operates in non-secure mode (over ws) + */ + #include "qwebsocketprotocol.h" #include "qwebsocket.h" #include "qwebsocketserver.h" @@ -154,7 +195,8 @@ QT_BEGIN_NAMESPACE /*! Constructs a new WebSocketServer 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{SECURE_MODE}) + or over ws (\l{NON_SECURE_MODE}). \a parent is passed to the QObject constructor. */ @@ -326,7 +368,7 @@ void QWebSocketServer::setSslConfiguration(const QSslConfiguration &sslConfigura If the server is not running in secure mode (QWebSocketServer::SECURE_MODE), this method returns QSslConfiguration::defaultConfiguration(). - \sa sslConfiguration(), SecureMode, QSslConfiguration::defaultConfiguration() + \sa setSslConfiguration(), SecureMode, QSslConfiguration::defaultConfiguration() */ QSslConfiguration QWebSocketServer::sslConfiguration() const { diff --git a/src/websockets/websockets.pro b/src/websockets/websockets.pro index 4b67717..4863180 100644 --- a/src/websockets/websockets.pro +++ b/src/websockets/websockets.pro @@ -10,6 +10,7 @@ DEFINES += QTWEBSOCKETS_LIBRARY QMAKE_DOCS = $$PWD/doc/qtwebsockets.qdocconfig OTHER_FILES += doc/src/*.qdoc # show .qdoc files in Qt Creator OTHER_FILES += doc/snippets/*.cpp +OTHER_FILES += doc/qtwebsockets.qdocconfig PUBLIC_HEADERS += \ $$PWD/qwebsockets_global.h \ -- 2.7.4