EventSource.readyState - Web API | MDN

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2020年1月.

readyStateEventSource インターフェイスの読み取り専用プロパティで、コネクションの状態を表す数値を返します。

コネクションの状態を表す数値。使用可能な値は以下の通りです。

  • 0 — 接続試行中
  • 1 — 接続中
  • 2 — 接続終了

js

const evtSource = new EventSource("sse.php");
console.log(evtSource.readyState);

仕様書

Specification
HTML
# dom-eventsource-readystate-dev

ブラウザーの互換性

関連情報

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.