SkillAgentSearch skills...

Sse

A Server-Sent Events component

Install / Use

/learn @segment-boneyard/Sse
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

sse

A nice Server-Sent Events api

Example

With a SSE endpoint that responds like this:

$ curl http://localhost/updates
data: foo

data: bar

data: quit

And a script that subscribes to its updates:

var sse = require('sse');

var unbind = sse('/updates', function(data){
  if (data == 'quit') unbind();
  console.log(data);
});

The console output will be:

foo
bar
quit

Installation

Install with component(1):

$ component install segmentio/sse

API

sse(url, fn)

Subscribe fn to events on url. Returns an unbind function.

License

MIT

Related Skills

View on GitHub
GitHub Stars60
CategoryDevelopment
Updated2y ago
Forks0

Languages

JavaScript

Security Score

65/100

Audited on Mar 18, 2024

No findings