Originally Posted by elitis
And correct me if I'm wrong but aren't server side events supposed to check for new updates automatically or do they just keep the connection open to allow the server-side code to do so?
1. both possible and needing slightly different php than normal. I recommend using PHP's APC instead of flat files or a DB to store community state. Writing a new value onto an existing event source will raise that event in javscript, which with an event handler, could display the new data that's contained in the event's arguments.
2. no, SSE do not use long-polling (aka ping city), that's an older technique that this replaces. Since one can always instantly SEND data to a server using ajax, the missing half was being able to instantly send data from the server to the client. That requires a constant connection. This means that unlike comet, SSE is near instant in getting data from server to client.
it's up to the server to decide when to send new data down the pipe, or a keepalive every 28 seconds. in php, you'de probably use a loop+sleep combo to poll a common data source; typically a DB, but like i said, i recommend APC since it's orders of magnitude faster than a DB.
Node.js is nice because all the common data can just live in a variable that all requests can see, whereas PHP "boots up" each time a connection comes in, and then has to fetch the data is is availalble using closure in node.js.
but anyways, all possible, and since EventSource is based on http, the format is simple to encode and apply to almost any back-end.