-2

I want to work on a project where i want to set a server which hosts videos, pictures, and texts. The main objective is to push up the media contents update to the client using Sever-Side Event.

It is more or less like digital signage player where i have to set up my own server and the client player. I'm totally new at this thing. Can someone give me any ideas on how i can do it. Just basic ideas would be great and i can search about them.

John Dvorak
  • 26,799
  • 13
  • 69
  • 83
aman
  • 87
  • 1
  • 7

1 Answers1

2

You might want to check out node-easysse and easysse-client

server

var easysse = require("easysse");
app.get("/chat-stream", easysse);

app.post("/chat", function(req, res) {
  easysse.emit("chat", req.body.username, req.body.message);
});

client

<script src="easysse-client.js"></script>
<script>
  var client = easysseClient.connect("/chat-stream");

  client.on("chat", function(username, message){
    console.log(username, "says", message);
  });

  $.post("/chat", {username: "mjackson", message: "hehe"});
  // "mjackson says hehe"
</script>

Api docs

Mulan
  • 129,518
  • 31
  • 228
  • 259
  • thank you for the response. Can you be more specific on how can i start. from what i understand it works with the chat push up notifications. Will it work on media updates as well? – aman Jul 01 '14 at 02:56
  • In the examples here, we're just sending strings, but you can send any payload of data that you like. After you try something more, you should post a more specific question. I'm not willing to write it for you ^_^ – Mulan Jul 01 '14 at 22:51
  • thank you. i will ask if i encountered any difficulties while doing this part. thank you again. :) – aman Jul 02 '14 at 05:39