Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
chainpad-netflux
Advanced tools
A convenient wrapper around the chainpad realtime engine and the netflux transport API
A convenient wrapper around the chainpad realtime engine and the netflux transport API
Use chainpad-netflux in conjunction with a chainpad server, requirejs, and any combination of a growing number of chainpad-related modules.
define([
'/api/config?cb=' + Math.random().toString(16).slice(2),
'/bower_components/chainpad-netflux/chainpad-netflux.js',
'/bower_components/textpatcher/TextPatcher.amd.js',
'/bower_components/chainpad-crypto/crypto.js'
], function (Config, Realtime, TextPatcher, Crypto) {
/* Some basic configuration for connecting to peers,
and encrypting content */
var config = {
initialState: '',
channel: '???',
websocketURL: Config.websocketURL,
cryptKey: '???',
crypto: Crypto
};
config.onInit = function (info) {
// to be called immediately after the object has been created
};
config.onReady = function (info) {
// initialize your app when your realtime session has synchronized
};
config.onAbort = function () {
// handle disconnection
};
config.onRemote = function () {
// integrate remote users changes
};
config.onLocal = function () {
// serialize your interface's content to other users
};
// create your realtime object
var rt = Realtime.start(config);
// listen for changes
$('#someUserInterfaceElement').on('change', config.onLocal);
});
Chainpad-Netflux exports a single method, start
, which accepts a configuration object and creates a realtime session.
The initial state of the document (string), which must be consistent among clients for Chainpad to function optimally.
Defaults to ''
(empty string) if no alternative is provided.
A 32 character Netflux channel identifier (string).
(Optional if you can provide a netflux network) String. probably provided by your server's config API.
A netflux network object, to be used in situations where your network has already been initialized, and you would like to create or connect to an additional channel.
A network
attribute in your config will override the websocketURL
if present.
A crypto module, such as chainpad-crypto, which encrypts and decrypts content before and after it is relayed by the server.
The encryption key used to encrypt your content.
See chainpad-crypto
(linked above) for more information.
function (info) which is executed once Chainpad has begun to initialize. Provides an object (info) exposing information which would otherwise be internal:
function (info), which is executed once Chainpad has fully synchronized the document's history.
info exposes realtime
(the chainpad object), as in onInit
, in case you decided not to supply an onInit call.
Your app will most likely need access to this object so that it can inspect the content of the collaborative document at any given time.
function (info), which is executed once your client is considered disconnected from the Netflux network.
info exposes reason
, a string specifying the circumstances of your disconnection.
function (info), which is executed each time your client becomes aware of remote users' changes to the document.
info exposes realtime
(the chainpad object).
Logic for integrating remote changes into your user's interface should be implemented here.
function (), which must implement logic for reading a local user's changes into the Chainpad instance.
Due to the fact that remote changes are received asynchronously, this function will also be executed prior to onRemote
being executed, ensuring that remote changes do not clobber your local changes before they are inserted into the collaborative document.
In instances where these changes would conflict, transformFunction
(specified below) will be called.
The pluggable Operational Transformation function to be supplied to Chainpad. See Chainpad: configuration parameters for more information.
The pluggable patch verification function to be supplied to chainpad. See Chainpad: configuration parameters for more information.
bower install chainpad-netflux
This library is currently licensed as LGPL-2.1. Previous versions of this library (v1.0.1 and below) were licensed as AGPL-3.0.
FAQs
A convenient wrapper around the chainpad realtime engine and the netflux transport API
The npm package chainpad-netflux receives a total of 69 weekly downloads. As such, chainpad-netflux popularity was classified as not popular.
We found that chainpad-netflux demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.