Server-Sent Event

Introduction

  • 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 Eventsarrow-up-right + data inside the web page.

  • It is similar with web socket, but 1-way direction, from server to client

  • You'll need a bit of code on the server to stream events to the front-end, but the client side code works almost identically to websocketsarrow-up-right in part of handling incoming events.

Implementation

Backend

Frontend

Reference

Last updated

Was this helpful?