Code Monkey home page Code Monkey logo

easy_sse's Introduction

Server Sent events with Express

One way event streams made easy.

How can I test this out?

 $ git clone https://github.com/PaperElectron/Easy_SSE.git
 $ npm install
 $ npm start

Open localhost:8080/ in a few browser windows and start clicking some buttons. The code comments and documentation load with the demo server.

Why not just use Socket.io?

Socket.io is complex, has pretty tough proxy requirements, and is pretty hard to add to an application.

This is pretty old hat by now, but over at MVP Innovation we were in need of a solid, low overhead, low disruption-to-codebase technology to push realtime data to our customers browsers. Obviously Socket.io right...? Well, that is pretty hard to stomach when you have a large, complex existing API that already does everything you need.

In a soft realtime situation, the better option may just be SSE, which is a fairly well supported HTML5 API (IE available with a polyfill). We don't need super instant responses, and we have a complex hosting solution that makes Socket.io pretty much a no go.

  • Endless data streams and updates from the server in real time.

  • Easily bind multiple server side data streams from one endpoint.

  • Demo uses event emitter, send events from anywhere inside your app.

  • Vastly simpler than websockets/socket.io if realtime two way streams aren't needed.

  • Arguably simpler than socket.io even for two way streams. Just send data back to your existing API endpoints and emit events.

More info?

Can I use that?

But there is a polyfill for IE right?

Where can I learn more about this?

Some helpful libraries.

iOS/mac

Android

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.