Code Monkey home page Code Monkey logo

event-source-demo's Introduction

EventSource Demo

通过3中请求方式学习 服务器端推送技术——Server-Sent Events (SSE)

  • EventSource 方法
  • fetch 方法
  • fetch 与 EventSource结合

⚙ 项目启动

  • 依赖下载 yarn
  • 开发运行 yarn start

SSE 介绍

SSE 是一种 HTML5 技术,它允许服务器向客户端发送事件,从而实现服务器端推送。相对于 WebSockets 或长轮询技术,SSE 提供了更简单的方式来实现服务器端推送,并且支持更广泛的客户端和服务器端。

在 SSE 中,客户端通过向服务器端发送一个 HTTP 请求,请求某个资源,并且指定响应的类型是"text/event-stream"。服务器端在响应请求时,将数据格式化为事件流的形式,并通过 HTTP 响应发送回客户端。客户端通过事件流中的数据,可以实现实时地更新 UI 等操作。

event-source-demo's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.