--- /dev/null
+include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+
+project = QtWebSockets
+description = Qt WebSockets Reference Documentation
+url = http://qt-project.org/doc/qt-$QT_VER/qtwebsockets
+version = $QT_VERSION
+
+examplesinstallpath = websockets
+
+qhp.projects = QtWebSockets
+
+qhp.QtWebSockets.file = qtwebsockets.qhp
+qhp.QtWebSockets.namespace = org.qt-project.qtwebsockets.$QT_VERSION_TAG
+qhp.QtWebSockets.virtualFolder = qtwebsockets
+qhp.QtWebSockets.indexTitle = Qt WebSockets
+qhp.QtWebSockets.indexRoot =
+
+qhp.QtWebSockets.filterAttributes = qtwebsockets $QT_VERSION qtrefdoc
+qhp.QtWebSockets.customFilters.Qt.name = QtWebSockets $QT_VERSION
+qhp.QtWebSockets.customFilters.Qt.filterAttributes = qtwebsockets $QT_VERSION
+
+qhp.QtWebSockets.subprojects = classes
+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
+
+
+tagfile = ../../../doc/qtwebsockets/qtwebsockets.tags
+
+depends += qtcore qtnetwork qtdoc
+
+headerdirs += ..
+
+sourcedirs += ..
+
+exampledirs += ../../../examples/ \
+snippets
+
+navigation.landingpage = "Qt WebSockets"
+navigation.cppclassespage = "Qt WebSockets C++ Classes"
+
+#imagedirs += ./images
+++ /dev/null
-/*!
- \module QtWebSockets
- \title QtWebSockets module
-
- The QtWebSockets module implements the WebSocket protocol as specified in \l {http://tools.ietf.org/html/rfc6455} {RFC 6455}.
- It solely depends on Qt (no external depencies).
- The module contains 2 main classes: QWebSocket and QWebSocketServer, with which one can create client- and server applications.
- */
+++ /dev/null
-include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
-
-project = QWebSockets
-description = QWebSockets Reference Documentation
-
-outputdir = html
-
-headerdirs += ..
-headers += ../qwebsocket.h \
- ../qwebsocketserver.h
-
-sourcedirs += ..
-sources += ../qwebsocket.cpp \
- ../qwebsocketserver.cpp \
- qwebsockets.qdoc
-
-exampledirs += ../../../examples/ \
- ../../../examples/echoclient \
- ../../../examples/echoserver
-
-#imagedirs += ./images
-
-depends += qtdoc qtnetwork qtcore
\ No newline at end of file
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2013 Kurt Pattyn <pattyn.kurt@gmail.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2013 Kurt Pattyn <pattyn.kurt@gmail.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtwebsockets-index.html
+ \since 5.2
+ \title Qt WebSockets
+ \brief Provides an implementation of the WebSocket protocol.
+
+ The QtWebSockets module implements the WebSocket protocol as specified in \l {http://tools.ietf.org/html/rfc6455} {RFC 6455}.
+ It solely depends on Qt (no external dependencies).
+
+
+ To use this module in your application, use the following include
+ statement:
+
+ \code
+ #include <QtWebSockets/QtWebSockets>
+ \endcode
+
+ To link against the module, add this line to your \l qmake \c
+ .pro file:
+
+ \code
+ QT += websockets
+ \endcode
+
+ \section1 Related information
+ \list
+ \li \l{Qt WebSockets C++ Classes}{C++ Classes}
+ \li \l{Qt WebSockets Examples}{Examples}
+ \endlist
+*/
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2013 Kurt Pattyn <pattyn.kurt@gmail.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/*!
+ \module QtWebSockets
+ \title Qt WebSockets C++ Classes
+ \ingroup modules
+ \qtvariable websockets
+ \brief List of C++ classes that provice WebSockets communication.
+
+ To use these classes in your application, use the following include
+ statement:
+
+ \code
+ #include <QtWebSockets/QtWebSockets>
+ \endcode
+
+ To link against the module, add this line to your \l qmake \c
+ .pro file:
+
+ \code
+ QT += websockets
+ \endcode
+*/
This example should ideally be used with the EchoServer example.
\section1 Code
We start by connecting to the `connected()` signal.
- \snippet echoclient.cpp constructor
+ \snippet echoclient/echoclient.cpp constructor
After the connection, we open the socket to the given \a url.
- \snippet echoclient.cpp onConnected
+ \snippet echoclient/echoclient.cpp onConnected
When the client is connected successfully, we connect to the `onTextMessageReceived()` signal, and send out "Hello, world!".
If connected with the EchoServer, we will receive the same message back.
- \snippet echoclient.cpp onTextMessageReceived
+ \snippet echoclient/echoclient.cpp onTextMessageReceived
Whenever a message is received, we write it out.
*/
The \a bytes argument is set to the number of bytes that were written in this payload.
\note This signal has the same meaning both for secure and non-secure websockets.
- As opposed to QSslSocket, bytesWritten() is only emitted when encrypted data is effectively written (\sa QSslSocket:encryptedBytesWritten()).
+ As opposed to QSslSocket, bytesWritten() is only emitted when encrypted data is effectively written (see QSslSocket:encryptedBytesWritten()).
\sa close()
*/
\sa error(), errorString()
*/
/*!
+ \fn void QWebSocket::sslErrors(const QList<QSslError> &errors)
+ QWebSocket 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 QWebSocket is unable to securely identify the peer.
+ Unless any action is taken, the connection will be dropped after this signal has been emitted.
+ If you want to continue connecting despite the errors that have occurred, you must call QWebSocket::ignoreSslErrors() from inside a slot connected to this signal.
+ If you need to access the error list at a later point, you can call sslErrors() (without arguments).
+
+ \a errors contains one or more errors that prevent QWebSocket from verifying the identity of the peer.
+
+ \note You cannot use Qt::QueuedConnection when connecting to this signal, or calling QWebSocket::ignoreSslErrors() will have no effect.
+*/
+/*!
\fn void QWebSocket::pong(quint64 elapsedTime, QByteArray payload)
Emitted when a pong message is received in reply to a previous ping.
If, for instance, you want to connect to a server that uses
a self-signed certificate, consider the following snippet:
- \snippet src_websockets_ssl_qwebsocket 6
+ \snippet src_websockets_ssl_qwebsocket.cpp 6
Multiple calls to this function will replace the list of errors that
were passed in previous calls.
d->ignoreSslErrors(errors);
}
+/*!
+ Sets the socket's SSL configuration to be the contents of \a sslConfiguration.
+
+ This function sets the local certificate, the ciphers, the private key and the CA certificates to those stored in \a sslConfiguration.
+ It is not possible to set the SSL-state related fields.
+ \sa sslConfiguration()
+ */
+void QWebSocket::setSslConfiguration(const QSslConfiguration &sslConfiguration)
+{
+ Q_D(QWebSocket);
+ d->setSslConfiguration(sslConfiguration);
+}
+
+/*!
+ Returns the socket's SSL configuration state.
+ The default SSL configuration of a socket is to use the default ciphers, default CA certificates, no local private key or certificate.
+ The SSL configuration also contains fields that can change with time without notice.
+
+ \sa setSslConfiguration()
+ */
+QSslConfiguration QWebSocket::sslConfiguration() const
+{
+ Q_D(const QWebSocket);
+ return d->sslConfiguration();
+}
+
#endif //not QT_NO_SSL
/*!
The echoserver example implements a web socket server that echoes back everything that is sent to it.
\section1 Code
We start by creating a QWebSocketServer (`new QWebSocketServer()`). After the creation, we listen on all local network interfaces (`QHostAddress::Any`) on the specified \a port.
- \snippet echoserver.cpp constructor
+ \snippet echoserver/echoserver.cpp constructor
If listening is successful, we connect the `newConnection()` signal to the slot `onNewConnection()`.
The `newConnection()` signal will be thrown whenever a new web socket client is connected to our server.
- \snippet echoserver.cpp onNewConnection
+ \snippet echoserver/echoserver.cpp onNewConnection
When a new connection is received, the client QWebSocket is retrieved (`nextPendingConnection()`), and the signals we are interested in
are connected to our slots (`textMessageReceived()`, `binaryMessageReceived()` and `disconnected()`).
The client socket is remembered in a list, in case we would like to use it later (in this example, nothing is done with it).
- \snippet echoserver.cpp processMessage
+ \snippet echoserver/echoserver.cpp processMessage
Whenever `processMessage()` is triggered, we retrieve the sender, and if valid, send back the original message (`send()`).
The same is done with binary messages.
- \snippet echoserver.cpp processBinaryMessage
+ \snippet echoserver/echoserver.cpp processBinaryMessage
The only difference is that the message now is a QByteArray instead of a QString.
- \snippet echoserver.cpp socketDisconnected
+ \snippet echoserver/echoserver.cpp socketDisconnected
Whenever a socket is disconnected, we remove it from the clients list and delete the socket.
Note: it is best to use `deleteLater()` to delete the socket.
*/
-QT += network
-
+load(qt_build_config)
TARGET = QtWebSockets
-TEMPLATE += lib
+QT += core network
-DEFINES += QTWEBSOCKETS_LIBRARY
+TEMPLATE = lib
-load(qt_module)
+DEFINES += QTWEBSOCKETS_LIBRARY
-QMAKE_DOCS = $$PWD/doc/qwebsockets.qdocconfig
+QMAKE_DOCS = $$PWD/doc/qtwebsockets.qdocconfig
+OTHER_FILES += doc/src/*.qdoc # show .qdoc files in Qt Creator
+OTHER_FILES += doc/snippets/*.cpp
PUBLIC_HEADERS += \
$$PWD/qwebsockets_global.h \
$$PWD/qwebsocketframe_p.cpp
HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS
+
+load(qt_module)
+load(configure)
load(qt_parts)