PoliticalFraming / politicalframing

http://www.politicalframing.com
9 stars 1 forks source link

Server-Sent Events as an alternative for Websockets #53

Open AlJohri opened 10 years ago

AlJohri commented 10 years ago

http://www.html5rocks.com/en/tutorials/eventsource/basics/

One reason SSEs have been kept in the shadow is because later APIs like WebSockets provide a richer protocol to perform bi-directional, full-duplex communication. Having a two-way channel is more attractive for things like games, messaging apps, and for cases where you need near real-time updates in both directions. However, in some scenarios data doesn't need to be sent from the client. You simply need updates from some server action. A few examples would be friends' status updates, stock tickers, news feeds, or other automated data push mechanisms (e.g. updating a client-side Web SQL Database or IndexedDB object store). If you'll need to send data to a server, XMLHttpRequest is always a friend.

some server side examples http://blog.alexmaccaw.com/killing-a-library

AlJohri commented 10 years ago

http://flask.pocoo.org/snippets/116/