
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
scaledrone-node-push
Advanced tools
Official Scaledrone Node.js pushing library
Allows for usage of all Scaledrone's REST API methods.
For the Node.js WebSocket API Client check out this link.
npm install scaledrone-node-push --save
Create a new instance of Scaledrone passing it the channelId and secretKey that you can find from the channel's page:
const Scaledrone = require('scaledrone-node-push');
const sd = new Scaledrone({
channelId: 'CHANNEL_ID',
secretKey: 'SECRET_KEY'
});
const message = { foo: 'bar' };
const room = 'notifications';
sd.publish(room, message, function(error, reply) {
if (error) {
console.error(error);
return;
}
console.log('Message published!', reply);
});
(async () => {
try {
const message = { foo: 'bar' };
const room = 'notifications';
const reply = await sd.publish(room, message);
console.log('Message published!', reply);
} catch (err) {
console.error(err);
}
})();
const message = { foo: 'bar' };
const rooms = ['notifications', 'lounge'];
sd.publish(rooms, message, function(error, reply) {
if (error) {
console.error(error);
return;
}
console.log('Published to multiple rooms!', reply);
});
(async () => {
const message = { foo: 'bar' };
const rooms = ['notifications', 'lounge'];
try {
const reply = await sd.publish(rooms, message);
console.log('Published to multiple rooms!', reply);
} catch (err) {
console.error(err);
}
})();
// Callback
sd.channelStats(function(error, reply) {
if (error) return console.error(error);
console.log(reply); // { users_count: 2 }
});
// Async/await
const stats = await sd.channelStats();
console.log(stats);
// Callback
sd.members(function(error, reply) {
if (error) return console.error(error);
console.log(reply); // ['bcI:GPhz6A2T', 'b58:fnaJaEfh']
});
// Async/await
const members = await sd.members();
console.log(members);
// Callback
sd.rooms(function(error, reply) {
if (error) return console.error(error);
console.log(reply); // ["room1", "room2"]
});
// Async/await
const rooms = await sd.rooms();
console.log(rooms);
// Callback
sd.roomMembers('my-room', function(error, reply) {
if (error) return console.error(error);
console.log(reply); // ['bcI:GPhz6A2T', 'b58:fnaJaEfh']
});
// Async/await
const members = await sd.roomMembers('my-room');
console.log(members);
// Callback
sd.allRoomMembers(function(error, reply) {
if (error) return console.error(error);
console.log(reply); // {"room1": ["user1", "user2"], "room2": ["user1"]}
});
// Async/await
const all = await sd.allRoomMembers();
console.log(all);
FAQs
Official Scaledrone Node.js pushing library
We found that scaledrone-node-push demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.