Skip to content

Instantly share code, notes, and snippets.

View mtrefzer's full-sized avatar

Michael Trefzer mtrefzer

  • Spain, San Miguel de Salinas
View GitHub Profile

Using server-sent events

Why and how?

  • Documentation: https://web.dev/articles/eventsource-basics
  • Use case: broadcasting data from server to browsers
  • Benefits:
    • Easy to understand and implement (only a few lines of code)
    • No library is needed
  • Can use same HTTP(S) authentication as elsewhere in the app (which can’t be done with websockets)