Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015년 7월.
* Some parts of this feature may have varying levels of support.
WebSocket 객체는 WebSocket 서버 연결의 생성과 관리 및 연결을 통한 데이터 송수신 API를 제공합니다.
WebSocket 객체를 생성하려면 WebSocket() 생성자를 사용하세요.
참고 : 이 기능은 Web Worker에서 사용할 수 있습니다.
새로운 WebSocket 객체를 생성해 반환합니다.
연결에 사용되는 이진 데이터의 유형입니다.
WebSocket.bufferedAmount 읽기 전용큐에 대기 중인 데이터의 바이트 수입니다.
WebSocket.extensions 읽기 전용서버에서 선택한 확장입니다.
WebSocket.protocol 읽기 전용서버에서 선택한 하위 프로토콜입니다.
WebSocket.readyState 읽기 전용연결의 현재 상태입니다.
WebSocket.url 읽기 전용WebSocket의 절대 URL입니다.
연결을 닫습니다.
WebSocket.send()전송할 데이터를 큐에 등록합니다.
addEventListener() 메서드를 사용하거나 WebSocket 인터페이스의 oneventname 속성에 수신기를 할당해서 아래의 이벤트를 수신할 수 있습니다.
closeWebSocket의 연결이 닫힐 때 발생합니다. onclose 속성으로도 수신할 수 있습니다.
errorWebSocket의 연결이, 일부 데이터 전송의 실패 등 오류로 인해 닫힐 때 발생합니다. onerror 속성으로도 수신할 수 있습니다.
messageWebSocket으로 데이터를 수신했을 때 발생합니다. onmessage 속성으로도 수신할 수 있습니다.
openWebSocket 연결이 열렸을 때 발생합니다. onopen 속성으로도 수신할 수 있습니다.
| WebSockets # the-websocket-interface |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2023년 7월 30일 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.