Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

razorframe

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

razorframe

Empowering real-time databases in Node.js

  • 1.0.14
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15
increased by66.67%
Maintainers
2
Weekly downloads
 
Created
Source

razorframe(beta) npm version

####Empowering real-time databases in Node.js


###Description
Razorframe is a Javascript library built on Node.js which enables developers to build a real-time client experience while maintaining traditional database implementations such as SQL.

We use a messaging queue, called a 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 an asynchronous 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.

###Installation Using npm:

$ npm i --save razorframe

###Example server.js:

const rz = require('razorframe');

/**
 * config parameters - passes into rb any user-defined callbacks
 * @param - {Object} http => instantiate an http server
 * @param - {Function} write => a DB write callback (user-defined)
 * @param - {Function} show => a DB pull callback (user-defined)
 */
const config = {
  write: addToDb,
  show: showAll,
};

/**
 * Instantiate razorframe passing in Node's http object
 * (to connect with your server) as well as the config object
 * which contains all the user-defined callbacks
 */
rz(http, config);

client.html:

<script src="/socket.io/socket.io.js"></script>

client.js:

const socket = io();

/**
 * MSG parameters
 * @param {string} MSG.contents => the message value 
 * @param {string} MSG.eventOut => the outbound event name
 * @param {string} MSG.channel => the channel name 
 */
textForm.addEventListener('submit', (e) => {
    e.preventDefault();

    const contents = textInput.value;
    const eventOut = 'msgSent';
    const channel = 'message-channel';
    
    socket.emit('msgSent', { contents, eventOut, channel });
    textInput.value = '';
});

###Platform Node.js

###Dependencies Socket.io

###Authors
Travis Huff
Eddie Park
Michael Sotkin

###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

Keywords

FAQs

Package last updated on 15 Dec 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc