WebSocket QML Type

QML 인터페이스 QWebSocket. 더 보기...

Import Statement: import QtWebSockets 1.8

속성

신호

방법

자세한 설명

웹소켓은 단일 TCP 연결을 통해 전이중 통신 채널을 제공하는 웹 기술입니다. 웹소켓 프로토콜은 2011년에 IETF에서 RFC 6455로 표준화되었습니다.

속성 문서

active : bool

true로 설정하면 지정된 URL로 서버에 연결됩니다. false로 설정하면 연결이 닫힙니다. 기본값은 false입니다.


errorString : string [read-only]

마지막으로 발생한 오류에 대한 설명을 포함합니다. 오류가 발생하지 않은 경우 이 문자열은 비어 있습니다.


negotiatedSubprotocol : string [read-only, since 6.4]

서버와 협상된 웹소켓 서브프로토콜입니다.

이 프로퍼티는 Qt 6.4에 도입되었습니다.


requestedSubprotocols : list<string> [since 6.4]

웹소켓 핸드셰이크에서 전송할 웹소켓 서브프로토콜의 목록입니다.

이 프로퍼티는 Qt 6.4에 도입되었습니다.


status : Status [read-only]

웹 소켓의 상태.

상태는 다음과 같은 값을 가질 수 있습니다:

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

url : url

연결할 서버 URL입니다. URL은 ws:// 또는 wss://의 두 가지 스키마 중 하나여야 합니다. 제공되지 않으면 ws://가 사용됩니다.


신호 문서

binaryMessageReceived(QString message)

이 신호는 바이너리 메시지가 수신될 때 전송됩니다. message 에는 수신된 바이트가 포함됩니다.

참고: 해당 핸들러는 onBinaryMessageReceived 입니다.


statusChanged(Status status)

이 신호는 웹소켓의 상태가 변경될 때 발생합니다. status 인수는 현재 상태를 제공합니다.

참고: 해당 핸들러는 onStatusChanged 입니다.

WebSocket::status도 참조하세요 .


textMessageReceived(QString message)

이 신호는 문자 메시지가 수신될 때 전송됩니다. message 에는 수신된 바이트가 포함됩니다.

참고: 해당 핸들러는 onTextMessageReceived 입니다.


메서드 문서

void sendBinaryMessage(ArrayBuffer message)

message 파라미터를 서버로 보냅니다.


void sendTextMessage(string message)

message 를 서버로 보냅니다.


© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.