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.
razorframe
Advanced tools
###Empowering scalable, real-time web apps in Node.js
###Visit us at: http://www.razorfra.me
##Table of Contents:
##Description
Razorframe is a Javascript library built on Node.js which enables developers to build a real-time client experience while maintaining scalable, async back-end operations.
Socket.io powers real-time client updates on the front-end, while Node clusters and event emitters in conjunction with a custom messaging queue process highly concurrent and asynchronous operations on the back-end.
We use a messaging queue, called razorframe, that intercepts incoming user interactions over a two-way socket channel. Those interactions are held in the queue only as long as the server needs before dequeuing. The dequeuing process then triggers an event that both updates the client UI and launches a back-end process such as a database write.
Our tests have shown this process keeps the client UI updating in sub 100ms "real-time" fashion at scale while maintaining accurate database writes.
$ npm i --save razorframe
##How to Use
###Hosted Redis server:
We have removed the hosted Redis server originally provided during initial rollout. In order to leverage concurrency with razorframe and ensure server -> client communication, be sure to instantiate a local or hosted Redis server for your application.
You can store your Redis reference in an environment variable, or fall back to a locally hosted instance (see below):
const REDIS_URL = process.env.REDIS_URL || { host: 'localhost', port: 6379 }
(1) Require razorframe
(2) Specify rzConfig
object to set up server processes by declaring:
rzConfig.port
: port where your server is listening.rzConfig.cluster
: true or false depending on whether you want to enable Node clusters.(3) Specify dbConfig
object to define your back-end callbacks
dbConfig.write
: 'create' function for database.dbConfig.show
: 'read' function for database.dbConfig.update
: 'update' function for database.dbConfig.delete
: 'delete' function for databse.(4) Initialize razorframe while passing in http (for your server) and the configurations
const rz = require('razorframe');
const rzConfig = {
port: process.env.PORT || 3000,
cluster: true
};
const dbConfig = {
write: addToDb,
show: showAll,
update: null,
delete: null,
};
rz.init(http, rzConfig, dbConfig);
###Client-side module:
HTML
Import 2 libraries: socket.io and razorframe into your HTML.
Grab the client-side import file from our website razorfra.me or use the hosted link below:
<script src="/socket.io/socket.io.js"></script>
<script src="http://parkedwards.github.io/parkedwards.github.io/razorframe.js"></script>
Javascript
Contains 2 methods:
rz.publish
- publishes a data payload to a particular event and specifies a back-end callbacktextForm.addEventListener('submit', (e) => {
e.preventDefault();
const contents = textInput.value;
rz.publish(contents, 'write', 'chatMsg')
textInput.value = '';
});
rz.subscribe
- listens for an event coming from the serverrz.subscribe('dbOnLoad', (data) => {
data.reverse().forEach(item => {
node = document.createElement('LI');
textNode = document.createTextNode(JSON.parse(item));
node.appendChild(textNode);
chatMsg.appendChild(node);
});
});
Error Handling:
Razorframe enables error handling on the back-end if your database fails to query.
Within the error callback on your database controller, use the method:
if (err) rz.onError(MSG, 2);
where 'MSG' is the task being sent to the database and the second argument, in this case '2', specifies the number of attempts to do the query. Razorframe will re-enqueue the task 'n' number of times with a default of 2 total attempts. If the event fails to query after all attempts, a message is sent to the user that enqueued the event that the event has failed to write and will be dropped.
##Demo App Check out our demo app for more usage examples at: RZ-Demo
##Platform Node.js
##Dependencies Socket.io
##Authors
Travis Huff
Eddie Park
Michael Sotkin
##Feedback Click this Link to leave feeback. We want to hear from you! ⚡️
##Support
Tested in Chrome 55 & Node 6/7.
GitHub Issues: https://github.com/team-emt/razorframe/issues
##Contributions
❤️ Contributions welcome!
Please see out GitHub repo at: https://github.com/team-emt/razorframe
##License
MIT
FAQs
Empowering scalable, real-time web apps in Node.js
The npm package razorframe receives a total of 15 weekly downloads. As such, razorframe popularity was classified as not popular.
We found that razorframe demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.