https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events * Skip to main content * Skip to search * Skip to select language Open main menu * ReferencesReferences + Overview / Web Technology Web technology reference for developers + HTML Structure of content on the web + CSS Code used to describe document style + JavaScript General-purpose scripting language + HTTP Protocol for transmitting web resources + Web APIs Interfaces for building web applications + Web Extensions Developing extensions for web browsers + Web Technology Web technology reference for developers * GuidesGuides + Overview / MDN Learning Area Learn web development + MDN Learning Area Learn web development + HTML Learn to structure web content with HTML + CSS Learn to style content using CSS + JavaScript Learn to run scripts in the browser + Accessibility Learn to make the web accessible to all * PlusPlus + Overview A customized MDN experience + Updates All browser compatibility updates at a glance + Documentation Learn how to use MDN Plus + FAQ Frequently asked questions about MDN Plus * Blog Search MDN[ ]Clear search inputSearch Theme * Log in * Get MDN Plus 1. References 2. Web APIs 3. Server-sent events Article Actions * English (US) In this article * Concepts and usage * Interfaces * Examples * Specifications * See also 1. Server-sent events 2. Guides 1. Using server-sent events 3. Interfaces 1. EventSource In this article * Concepts and usage * Interfaces * Examples * Specifications * See also Server-sent events Traditionally, a web page has to send a request to the server to receive new data; that is, the page requests data from the server. With server-sent events, it's possible for a server to send new data to a web page at any time, by pushing messages to the web page. These incoming messages can be treated as Events + data inside the web page. Note: This feature is available in Web Workers Note: Firefox does not currently support the use of server-sent events in service workers (it does support them in dedicated and shared workers). See Firefox bug 1681218. Concepts and usage To learn how to use server-sent events, see our article Using server-sent events. Interfaces EventSource Defines all the features that handle connecting to a server, receiving events/data, errors, closing a connection, etc. Examples * Simple SSE demo using PHP Specifications Specification HTML Standard # server-sent-events See also Tools * Mercure: a real-time communication protocol (publish-subscribe) built on top of SSE * EventSource polyfill for Node.js * Remy Sharp's EventSource polyfill * Yaffle's EventSource polyfill * Rick Waldron's jquery plugin * intercooler.js declarative SSE support Related Topics * AJAX * JavaScript * WebSockets Other resources * A Twitter like application powered by server-sent events and its code on GitHub. * HTML5 and Server-sent events Found a content problem with this page? * Edit the page on GitHub. * Report the content issue. * View the source on GitHub. Want to get more involved? Learn how to contribute. This page was last modified on May 3, 2023 by MDN contributors. Your blueprint for a better internet. * MDN on Twitter * MDN on GitHub MDN * About * Blog * Careers * Advertise with us Support * Product help * Report an issue Our communities * MDN Community * MDN Forum * MDN Chat Developers * Web Technologies * Learn Web Development * MDN Plus * Hacks Blog * Website Privacy Notice * Cookies * Legal * Community Participation Guidelines Visit Mozilla Corporation's not-for-profit parent, the Mozilla Foundation. Portions of this content are (c)1998-2023 by individual mozilla.org contributors. Content available under a Creative Commons license.