Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
fivetwelve-bridge
Advanced tools
bridge to connect the fivetwelve library running in the browser to a server handling dmx-interfaces
The fivetwelve-bridge connects fivetwelve running in the browser to a server-instance handling communication with the dmx-interfaces.
It provides a minimal http-server with websocket-support that takes care of two things:
npm install --save fivetwelve-bridge
In node, you need to setup the output the bridge will be writing to (this is the one that's connected to your dmx-interface) and attach the bridge to it:
import fivetwelve from 'fivetwelve';
import bridge from 'fivetwelve-bridge';
// setup the real dmx-output with your drivers
const output = fivetwelve(dmxDriver);
output.start(1000/30);
// start the bridge-server
const bridge = bridge(output);
bridge.listen(31821, 'localhost', () => {
console.log('fivetwelve-bridge is listening on localhost:31821');
});
You can also start the bridge before the output is initialized:
// start the bridge-server
const bridge = bridge(output);
bridge.listen(31821, 'localhost', () => {
console.log('fivetwelve-bridge is listening on localhost:31821');
});
// then sometime later, when your output is available (or changed)
bridge.setOutput(dmxOutput);
(see also dev-server.js
for a minimal example)
In your browser-code you can load the client-library directly from the server started in the previous step:
<script src="localhost:31821/fivetwelve-client.js"></script>
This will provide you with the full fivetwelve-library via the global variable
window.fivetwelve
and the driver to connect to the server as window.fivetwelve.driver
.
You can now use the following code to start using fivetwelve in the browser:
const output = new fivetwelve.DmxOutput(fivetwelve.driver);
output.start(1000/30);
// initialize devices etc. – all changes to the outputs dmx-buffers will
// automatically appear on the server.
However, most of the time you are probably using a module-bundler anyway. In this case, you might want to use this module as a library, which could be done like this:
import fivetwelve from 'fivetwelve';
import {initFivetwelveClient} from 'fivetwelve-bridge/client';
const driver = initFivetwelveClient('ws://localhost:31821');
const output = fivetwelve(driver);
PLEASE NOTE As all fivetwelve-modules, this module was written in ES6 using modules-syntax and does not provide a compiled-to-es5-version with the package. To consume this module, you will need to configure your application accordingly.
For example by using
babel-register
like this:
require('babel-register')({ presets: ['node6'], ignore: /node_modules\/(?!fivetwelve)/ });
For running a quick test and for development, you can run
npm install
npm start
This will start a development-server on port 1234 that serves an empty
(well, except for loading fivetwelve-client.js
) html-file as index.html
and prints the state of the dmx-universe received on the server to your
console.
FAQs
bridge to connect the fivetwelve library running in the browser to a server handling dmx-interfaces
The npm package fivetwelve-bridge receives a total of 5 weekly downloads. As such, fivetwelve-bridge popularity was classified as not popular.
We found that fivetwelve-bridge 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.