--- /dev/null
+/****************************************************************************
+**
+** 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}
+*/
--- /dev/null
+/****************************************************************************
+**
+** 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}
+*/
--- /dev/null
+/****************************************************************************
+**
+** 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
+*/
--- /dev/null
+/****************************************************************************
+**
+** 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.
+*/
--- /dev/null
+/****************************************************************************
+**
+** 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}
+*/
--- /dev/null
+/****************************************************************************
+**
+** 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}
+*/
--- /dev/null
+/****************************************************************************
+**
+** 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
+*/
**
****************************************************************************/
+/*!
+ \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 <QtWebSockets/QWebSocket>
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
headerdirs += ..
-sourcedirs += ..
+sourcedirs += .. \
+ src
exampledirs += ../../../examples/ \
-snippets
+ snippets
navigation.landingpage = "Qt WebSockets"
navigation.cppclassespage = "Qt WebSockets C++ Classes"
** $QT_END_LICENSE$
**
****************************************************************************/
+//! [6]
+QList<QSslCertificate> cert = QSslCertificate::fromPath(QLatin1String("server-certificate.pem"));
+QSslError error(QSslError::SelfSignedCertificate, cert.at(0));
+QList<QSslError> expectedSslErrors;
+expectedSslErrors.append(error);
+
+QWebSocket socket;
+socket.ignoreSslErrors(expectedSslErrors);
+socket.open("wss://myserver.at.home");
+//! [6]
\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}
*/
/*!
/*!
* \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),
{}
/*!
- \internal
+ Destroys the object.
*/
QWebSocketCorsAuthenticatorPrivate::~QWebSocketCorsAuthenticatorPrivate()
{}
}
/*!
- 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))
}
#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);
#endif
+/*!
+ Swaps \a other with this authenticator.
+
+ This operation is very fast and never fails.
+ */
void QWebSocketCorsAuthenticator::swap(QWebSocketCorsAuthenticator &other)
{
if (&other != this) {
*/
/*!
- \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
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<QSslError> &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"
/*!
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.
*/
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
{
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 \