--- title: Server-sent events slug: Web/API/Server-sent_events translation_of: Web/API/Server-sent_events ---

網頁一般來說是由客戶端向伺服器請求資料. 藉由 server-sent 事件, 伺服器在任何時候都可以向客戶端推送資料. 即將推送進來的訊息可以自客戶端上做 Events + data 處理.

文件

使用 server-sent events
有關如何在伺服器端和客戶端使用 server-sent 事件的教學文章.
參考 EventSource
關於客戶端的 EventSource API.

瀏覽全部...

工具

參見

規範

Specification Status Comment
{{SpecName('Server-sent events')}} {{Spec2('Server-sent events')}} Initial definition.

瀏覽器相容性

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
EventSource support 9 {{CompatGeckoDesktop("6.0")}} {{CompatUnknown}} 11 5
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
EventSource support {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}