Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
A lightweight cometD Library with lightweight dependencies. No jQuery needed!
##A Simple HowTo:
Install the library
npm install --save cometd
Include the library
var cometD = require('cometd').cometD();
Subscribe to a topic
cometD.topic = '/topic/exampleTopic';
Add a eventListener
cometD.addEventListener('/topic/exampleTopic', function (topic, message) {});
Start the execution
cometD.init(
{
token: "A optional Bearer token",
url: 'http://urltoyourservice.com/cometd/26.0',
debug: true
}
);
###Multi Subscription
You have two options for subscribe more than one topic. You can use a wildcard in your topic like this:
cometD.topic = '/topic/*';
If you use this, you can add a eventListener to each channel.
cometD.addEventListener('/topic/topic1', function (topic, message) {});
cometD.addEventListener('/topic/topic2', function (topic, message) {});
Or you can use only one handler function. You can also access the topicName:
function myHandler(theTopicName, message){
console.log(theTopicName);
}
cometD.addEventListener('/topic/topic1', myHandler);
cometD.addEventListener('/topic/topic2', myHandler);
Sometime wildcards are not available. But this isn't a problem. The cometD object isn't a singleton. Each Instance has his own cookie.
var topics = ['topic1', 'topic2'];
function myCometDFunction(topic){
var cometD = require('./cometD.js').cometD();
cometD.topic = '/topic/' + topic;
cometD.init(
{
token: "Bearer Token",
url: 'http://aserviceurl.com/cometd/26.0',
debug: true
}
);
cometD.addEventListener('/topic/' + topic, function(topicName, message){});
}
for (var i = 0; i < topics.length; i++) {
myCometDFunction(topics[i]);
}
FAQs
A lightweight cometD Library with lightweight dependencies. No jQuery needed!
The npm package cometdjs receives a total of 2 weekly downloads. As such, cometdjs popularity was classified as not popular.
We found that cometdjs 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.