Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
socksub.io
Advanced tools
Readme
SockSub + Socket.IO + Promises = great websocket interface
var http = require('http');
var SockSubIO = require('socksub.io');
var socksub = SockSubIO();
socksub.auth(function(credentials, next){
if(credentials.username === 'me' && credentials.password === 'p4sSw0rD'){
var user = {
id: 1
};
return next(null, user);
}
throw new Error("Invalid credentials");
});
socksub.expose('add', function(nb1, nb2){
return nb1 + nb2;
});
socksub.subscription('/myEvent/:user', function(req){
if(req.params.user !== req.user.id){
throw new Error("Subscription not authorized");
}
});
var counter = 1;
setInterval(function(){
socksub.dispatch('/myEvent/1', counter++);
socksub.dispatch('/myEvent/2', counter++);
socksub.dispatch('/myEvent/3', counter++);
}, 1000);
var server = http.createServer();
socksub.attach(server);
server.listen(3000);
var SockSubIO = require('socksub.io');
var socksub = SockSubIO();
socksub.login({
username: 'me',
password: 'p4sSw0rD'
}).done();
socksub.request('add', 3, 4).done(function(result){
console.log("3 + 4 = %d", result);
});
socksub.on('/myEvent/1', function(counter){
console.log('/myEvent/1', counter);
});
socksub.on('/myEvent/2', function(counter){
console.log('/myEvent/2', counter);
});
socksub.subscribe('/myEvent/1').done();
socksub.subscribe('/myEvent/2').done();
FAQs
SockSub + Socket.IO + Promises = great websocket interface
The npm package socksub.io receives a total of 2 weekly downloads. As such, socksub.io popularity was classified as not popular.
We found that socksub.io 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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.