Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. WebSocket
  4. readyState

WebSocket: readyState property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨July 2015⁩.

Note: This feature is available inWeb Workers.

TheWebSocket.readyState read-only property returns thecurrent state of theWebSocket connection.

Value

A number which is one of the four possible state constants defined on theWebSocket interface:

WebSocket.CONNECTING (0)

Socket has been created. The connection is not yet open.

WebSocket.OPEN (1)

The connection is open and ready to communicate.

WebSocket.CLOSING (2)

The connection is in the process of closing.

WebSocket.CLOSED (3)

The connection is closed or couldn't be opened.

Specifications

Specification
WebSockets
# ref-for-dom-websocket-readystate①

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp