UNPKG

@steelbreeze/broker

Version:

Lightweight publish and subscribe using Server-Sent Events for node and express

14 lines (10 loc) 407 B
const express = require('express'); const broker = require('@steelbreeze/broker'); // create the express application var app = express(); // create a message broker that provides the last message on subscription var events = broker.server({lastMessage: true}); // bind the message broker to the /events base URL app.use('/events', events); // start the express application app.listen(1024, 'localhost');