![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@steelbreeze/broker
Advanced tools
Lightweight publish and subscribe using Server-Sent Events for node and express
Lightweight publish and subscribe using Server-Sent Events for node and express
If you like broker, please star it...
npm i @steelbreeze/broker
To create a message broker server within an express application:
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');
You can create multiple message broker servers and bind them to different base URLs in the same express application.
To create a subscription:
const broker = require('@steelbreeze/broker');
// create a client to the message broker
var client = broker.client({host:'localhost', port: 1024, path: '/events'});
// subscribe to the devices topic on the /events broker
client.subscribe('devices', (message) => {
console.log(`All devices: (${message.id}) ${message.data}`);
});
A single client can subscribe to multiple topics.
To create a subscription:
const broker = require('@steelbreeze/broker');
// create a client to the message broker
var client = broker.client({host:'localhost', port: 1024, path: '/events'});
// publish a message on the devices topic of the /events broker every second
var timer = setInterval( () => {
client.publish('devices', `Hello at ${new Date()}`, onError);
}, 1000);
function onError() {
clearInterval(timer);
}
In addition to using the provided client, a browser's EventSource
may be used to subscribe and an HTTP POST can be used to publish.
Note: for some browsers this may require an EventSource polyfill.
MIT License
Copyright (c) 2018 David Mesquita-Morris
FAQs
Lightweight publish and subscribe using Server-Sent Events for node and express
We found that @steelbreeze/broker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.