Server Sent Events, sincerely, most definitely


Easy Server-Sent Events, sincerely, most definitely

This demo show easysse-client working in tandem with node-easysee

$ cd node-easysse && npm install && npm run-script example
> easysse@0.0.0 example /Users/dnukem/code/easysse
> node ./example
listening on

Open a couple browser tabs at the binding address and click the button. Each tab will be synchronized with one another.

Currently easysse is configured as an express middleware

var require("easysse");
app.get("/chat-stream", easysse);
app.post("/chat", function(reqres) {
  easysse.emit("chat", req.body.username, req.body.message);

Using easysse-client

<script src="easysse-client.js"></script>
  var client = easysseClient.connect("/chat-stream");
  client.on("chat", function(usernamemessage){
    console.log(username, "says", message);
  $.post("/chat", {username: "mjackson", message: "hehe"});
  // "mjackson says hehe" 
  • easysse — is an express middleware with two parameters (req and res)

  • easysse.emit(eventType[, arg1, ..., argN]) — emit an event to all connected clients

Tested on Chrome 33 Please submit any other compatibility reports

© 2014 nkitsune, mosdef.biz easysse may be freely distributed under the BSD license. For all details and documentation: https://github.com/mosdefbiz/easysse