WebSocket QML Type

QML 接口到 QWebSocket . 更多...

import 語句: import QtWebSockets 1.1
Since: Qt 5.3

特性

信號

方法

詳細描述

WebSocket 是通過單 TCP 連接提供全雙工通信通道的 Web 技術。WebSocket 協議由 IETF 標準化為 RFC 6455 in 2011.

特性文檔編製

active : bool

When set to true, a connection is made to the server with the given url. When set to false, the connection is closed. The default value is false.

errorString : QString

Contains a description of the last error that occurred. When no error occurrred, this string is empty.

status : Status

Status of the WebSocket.

The status can have the following values:

  • WebSocket.Connecting
  • WebSocket.Open
  • WebSocket.Closing
  • WebSocket.Closed
  • WebSocket.Error

url : QUrl

Server url to connect to. The url must have one of 2 schemes: ws:// or wss:// . When not supplied, then ws:// 被使用。


信號文檔編製

binaryMessageReceived ( QString message )

This signal is emitted when a binary message is received.

This signal was introduced in Qt 5.8.

statusChanged ( Status status )

This signal is emitted when the status of the WebSocket changes. the status argument provides the current status.

另請參閱 WebSocket::status .

textMessageReceived ( QString message )

This signal is emitted when a text message is received.


方法文檔編製

void sendBinaryMessage ( ArrayBuffer message )

發送 message to the server.

This method was introduced in Qt 5.8.

void sendTextMessage ( string message )

發送 message to the server.