8 | 9 | 10 | 11 |
12 |13 | 14 |
15 |16 | 17 | 18 |
19 | 20 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /examples/websockets/sslechoserver/sslechoclient.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |10 | 11 | 12 | 13 |
14 |15 | 16 |
17 |18 | 19 | 20 |
21 | 22 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /src/websockets/doc/src/overview.qdoc: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2017 The Qt Company Ltd. 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only 3 | 4 | /*! 5 | \page websockets-overview.html 6 | \title Qt WebSockets Overview 7 | \brief Provides insight into the WebSocket protocol and the Qt WebSockets module. 8 | \ingroup explanations-webtechnologies 9 | 10 | Qt WebSockets enables you to build WebSocket-aware applications. It 11 | provides an implementation for the WebSocket protocol, which is offered by IETF 12 | (Internet Engineering Task Force) as a better alternative for bidirectional 13 | communication using the existing web infrastructure. 14 | 15 | Historically, web applications that needed bidirectional communication or 16 | push notifications had to use one of the HTTP-based solutions available. These 17 | solutions employed different techniques such as polling, long-polling, and 18 | streaming, to overcome the limitations of HTTP protocol, which is not designed 19 | for such use cases. This resulted in high network latency, unnecessary data 20 | exchange, and stale or old data. The WebSocket offering by IETF helps to 21 | overcome these problems to a large extent. 22 | 23 | \section1 How does it Work? 24 | 25 | \image websockets-pictorial-representation.jpg WebSocket protocal flow diagram 26 | 27 | As you can see in the pictorial representation, WebSocket-based solution 28 | consists of a client-side and server-side. The native client-side support for 29 | WebSocket is available on most of the popular web browsers such as Google 30 | Chrome, Internet Explorer, Safari, and so on. The server-side support for 31 | WebSocket makes it a complete solution, enabling bidirectional communication. 32 | Any browser with native WebSocket support should let you run a simple HTML and 33 | JavaScript-based client application using the HTML5 WebSocket API. 34 | 35 | A WebSocket connection begins with a initial HTTP-compatible handshake, 36 | which ensures backwards compatibility so that the WebSocket connections can 37 | share the default HTTP (80) and HTTPS (443) ports. On successful handshake, 38 | the connection is open for data exchange, until one of the two entities end 39 | the connection. 40 | 41 | The WebSocket protocol uses \c ws: and \c wss: URL schemes to represent 42 | unsecure and secure WebSocket requests, respectively. During the initial 43 | handshake, if a proxy server is detected, the protocol tries to set up a tunnel 44 | by issuing an \c{HTTP CONNECT} statement to the proxy. The tunnel approach to 45 | handle proxies is used irrespective of the request type, although it is proved 46 | to work better with TLS (Transport Layer Security) in secure connections. 47 | 48 | \section1 Typical Use Cases 49 | 50 | WebSocket suits best for scenarios where, 51 | \list 52 | \li data presented must be up-to-date, 53 | \li low network latency and minimal data exchange is crucial. 54 | \endlist 55 | 56 | A few example applications where we struggle to achieve these using the 57 | traditional approach are, instant messaging, online gaming, online stock 58 | trading, and so on. 59 | 60 | \section1 Role of Qt WebSockets 61 | 62 | The Qt WebSockets module provides APIs to develop WebSocket-based server and 63 | client applications. An example of where these APIs can be used is a server 64 | application that provides stock data, and a client application that registers 65 | for push notification when there is a change in price of a few stocks. 66 | 67 | The module provides both C++ and QML versions of the API, so you can choose 68 | the alternative that suits your need. 69 | 70 | \section2 Qt WebSockets with Cloud Services 71 | 72 | The client application usually depends on an external service for data. Most of 73 | these service providers do not support WebSocket yet, so you end up developing 74 | a WebSocket-aware server application to bridge the gap. You can run the server 75 | on an enterprise WebSocket gateway service such as a cloud service, avoiding 76 | the hassle of maintaining the necessary infrastructure required to host such 77 | a service. 78 | 79 | Most of the cloud Services provide a Platform as a service (PaaS) backend, 80 | which enables deploying and running an instance of your server application on 81 | the cloud. The client applications can connect to the running server using a 82 | WebSocket URL and receive data. 83 | 84 | \section2 Related Information 85 | \list 86 | \li \l{RFC 6455} 87 | \endlist 88 | */ 89 | --------------------------------------------------------------------------------