github/hubot-scripts — pull request #1044 by jimbojw (2013-07-22 19:30:01+00:00)
Title: Implementing minime script for Server-Sent Event broadast

minime provides infrastructure for pushing messages from chat out to browser-based subscriber applications. This consists of a [Server-Sent Events](http://www.html5rocks.com/en/tutorials/eventsource/basics/) endpoint, and a new command for publishing messages to it from chat.

For example, say you're running hubot locally. You could have a page with this code:

```

```

Then in chat, you'd call this:

```
@hubot minime hey there
```

Inside the `onmessage` callback, the `payload.message` will be the string "hey there". Your browser-based application can do whatever it likes with this message. It could run a test case, ping a server, load a resource, etc.

The script adds `/minime/events` and `minime/iframe` to the router so those paths can be used by subscribers. The `/minime/test` path is also available as an example of how to use the iframe to subscribe to minime events across domains.