Qt WebChannel ChatClient HTML 예제
WebSocket을 통해 QWebChannel 서버와 통신하는 HTML/JavaScript 클라이언트입니다.

ChatClient HTML은 JavaScript와 HTML을 사용하여 구현된 간단한 QWebChannel 클라이언트를 제공합니다.
예제 실행
예제를 실행하려면 브라우저에서 chatclient.html 파일을 엽니다.
웹 채널 클라이언트 구현
클라이언트는 채팅 서버에 대한 WebSocket 연결을 초기화하고, 채팅 클라이언트를 구현하는 데 필요한 모든 시그널, 슬롯 및 속성이 포함된 객체를 수신합니다.
로그인 후, 클라이언트는 sendMessage 메서드를 호출하고 newMessage 시그널을 수신하여 메시지를 주고받을 수 있습니다. 또한, userList 속성은 연결된 다른 모든 클라이언트의 이름을 제공합니다. 이 목록은 내용이 변경되면 자동으로 업데이트됩니다. 아울러, 클라이언트는 연결이 끊긴 클라이언트를 감지하고 userList 속성에서 해당 클라이언트를 제거하는 데 필요한 서버의 keep-alive 시그널에 응답합니다.
이 예제는 신호 연결(newMessage), 슬롯 호출(sendMessage), 속성 변경 처리(userList)와 같이 QWebChannel 의 클라이언트 JavaScript 구현에서 기본 요소를 사용하는 방법을 보여줍니다.
클라이언트는 Qt WebChannel 의 ChatServer 예제를 활용할 수 있습니다.
Qt WebChannel 채팅 서버 예제와 Qt WebChannel 채팅 클라이언트 QML 애플리케이션도 참조하십시오 .
© 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.