SSE is utility set for using Server Sent Events with Craft.
SSE is perfect when you only need one-way communication from the server. Some examples:
- Checking if a user is online
- Pushing the latest notifications
- Showing a site-wide message from the site administrator saying the site will be going down for upgrades in x minutes
Read more about SSE at Mozilla Developer Network
To install SSE, follow these steps:
- Download & unzip the file and place the
sse
directory into yourcraft/plugins
directory - Install plugin in the Craft Control Panel under Settings > Plugins
- The plugin folder should be named
sse
for Craft to see it.
SSE works on Craft 2.4.x and Craft 2.5.x.
<script>
var sse = new EventSource("{{ actionUrl('SSE/index') }}");
sse.addEventListener('update',function(e){
var data = e.data;
//handle your data here
},false);
</script>
- Make it useful
Brought to you by Superbig