QML WebSocket client

Author: Yiqu, Ersanli
Personal Wechat ID: iwaleon
Wechat Official Account: Efficient Programmer

WebSocket is a network transport protocol for two-way communication (full duplex) between a client and a server. It provides a persistent connection for web applications to transfer data between client and server in real time without establishing a new connection on each request. The application scenarios of this real-time communication technology are very wide, such as social chat, online games, stock quotes, collaborative editing and live sports, etc.

To implement a WebSocket client in QML, you need to use the WebSocket type, which is implemented based on QWebSocket in C++/Qt. Therefore, as long as you know how to use QWebSocket, you can quickly get started with WebSocket.

The complete mind map is as follows:

insert image description here

data transfer method

In data transmission, in addition to the full-duplex mentioned above, there are several common ways as follows:

  • Full-duplex: Allows data to be transmitted in both directions simultaneously, the sender and receiver can send and receive data at the same time. For example: on the phone, you can hear the other party's voice while talking. Common full-duplex protocols include WebSocket, TCP/IP, etc.

  • Half-duplex: Data can be transmitted in two directions, but only one-way transmission is allowed at the same time, that is, two-way alternate communication. For example: walkie-talkie, only one party is allowed to talk at the same time

Guess you like

Origin blog.csdn.net/u011012932/article/details/132344612