IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

WebSocket QML Type

QML interface to QWebSocket.

This type was introduced in Qt 5.3.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

WebSocket QML Type

  • Import Statement: import QtWebSockets 1.4

  • Since:: Qt 5.3

  • Group: WebSocket is part of websockets-qml

Detailed Description

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.

Property Documentation

 

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.

[read-only] errorString : QString

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

[read-only, since 6.4] negotiatedSubprotocol : QString

The WebSocket subprotocol that has been negotiated with the server.

This property was introduced in Qt 6.4.

[since 6.4] requestedSubprotocols : QStringList

The list of WebSocket subprotocols to send in the WebSocket handshake.

This property was introduced in Qt 6.4.

[read-only] 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:// is used.

Signal Documentation

 

[since 5.8] binaryMessageReceived(QString message)

This signal is emitted when a binary message is received. message contains the bytes received.

The corresponding handler is onBinaryMessageReceived.

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.

The corresponding handler is onStatusChanged.

See Also

textMessageReceived(QString message)

This signal is emitted when a text message is received. message contains the bytes received.

The corresponding handler is onTextMessageReceived.

Method Documentation

 

[since 5.8] void sendBinaryMessage(ArrayBuffer message)

Sends the parameter message to the server.

This method was introduced in Qt 5.8.

void sendTextMessage(string message)

Sends message to the server.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+