Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
dead simple websocket communication module.
Stream JSON data easily with events between clients and server. You can broadcast to all clients, or just one.
runs in node and in the browser with browserify!
It's basically a simple wrapper built around the awesome module emit.io
npm install agora
var Server = require('agora').Server;
var server = new Server({
port: 8000
});
server.on('connection', function (conn) {
var id = conn.id;
/* returned inStream is an emitter */
var inStream = conn.inStream;
/* you can emit to the outStream and data will
* be piped off to the client */
var outStream = conn.outStream;
/*
* listen on a per client basis
* in this case, we listen for the 'addOne' event from the client,
* and we can wrangle it, then send it back with an 'addResult' event
*/
inStream.on('addOne', function (data) {
server.emitTo(outStream, 'addResult', data += 1);
});
/* emit to one client */
server.emitTo(outStream, 'ready', id);
});
/* or emit to everyone! */
setInterval(function () {
server.emit('serverTime', new Date());
}, 1000);
var Client = require('agora').Client;
var client = new Client();
/*
* once we get the ready event from the server,
* we're good to go! we can now start emitting
* and the server will hear the events!
*/
client.on('ready', function (id) {
client.id = id;
client.emit('addOne', 1);
});
/*
* once you've built your server API, you can
* listen to events. Here we've set up
* an addResult event.
*/
client.on('addResult', function (data) {
var div = document.getElementById('#someDiv');
div.innerHTML = data;
setTimeout(function () {
client.emit('addOne', data);
}, 5000);
});
client.on('serverTime', function (date) {
console.log(date);
});
/* connect the client! */
client.connect('ws://localhost:8000');
var Signals = require('agora');
Creates a new instance of a websocket server.
opts.port
| specify the port number int
Creates a new instance of a websocket client.
Connects to the websocket server at the provided address
| String.
MIT
FAQs
simple websocket communication module
The npm package agora receives a total of 8 weekly downloads. As such, agora popularity was classified as not popular.
We found that agora 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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.