QML 웹소켓 클라이언트
QML WebSocket 클라이언트 예제를 작성하는 방법을 설명합니다.
이 QML WebSocket 클라이언트 예제는 QML API를 사용하여 에코 서버에 보안 및 비보안 WebSocket 연결을 생성하고, 연결을 열었다 닫았다를 반복합니다. 연결이 열릴 때마다 메시지를 전송합니다.

이 예제는 환영 메시지가 표시된 창을 엽니다. 창을 클릭할 때마다 외부 에코 서버와의 두 개의 연결을 번갈아 열고 닫습니다. 사용되는 에코 서버는 ws.ifelse.io이며, 예제가 작동하려면 인터넷 연결이 필요합니다. 또한 보안 연결이 작동하려면 TLS가 활성화되어 있어야 합니다. 연결이 열리거나 닫힐 때, statusChanged 신호는 onStatusChanged 핸들러에 의해 처리됩니다. 소켓이 열릴 때마다 메시지가 전송되며, 소켓이 닫힐 때마다 창에 메시지가 기록됩니다. 또한, 서버에서 수신된 메시지를 창에 기록하는 onTextMessageReceived 핸들러가 있습니다.
© 2026 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.