@refractionx/rfx-art-net-node

1.0.6 • Public • Published

Checkout Example app

Install

npm i --save @refractionx/rfx-art-net-node

Import

import { RFXArtNetPacket, RFXArtNetWSProxyServer, getWebSocketFrame } from '@refractionx/rfx-art-net-node';

Setup optional WS/Art-Net (UDP) Proxy

...
import udp from 'dgram';
// example client used to proxy Art-Net packets
const client = udp.createSocket('udp4');
...
RFXArtNetWSProxyServer(serverOrPort, function onClient(socket) {
    // write example
    // create an RFXArtNetPacket with 3 channels and send over the WebSocket
    const packetWS = new RFXArtNetPacket(3);
    socket.write(getWebSocketFrame(packetWS));
}, function onPacket(packet) {
    // read and proxy Art-Net packet over UDP example
    client.send(packet, 6454, 'localhost');
});
...

Use

const packet = new RFXArtNetPacket(512);

// inspect packet
console.log(packet.hex());

// inspect data channels
console.log(packet.channels);

packet.setUniverse(1);
packet.setSequence(0);

// inspect Art-Net buffer
console.log(packet.buffer);
...

// get a WebSocket frame to send directly
socket.write(getWebSocketFrame(packet));

// or send over UDP as a normal Art-Net packet
client.send(packet, 6454, '...host..or..ip');

/@refractionx/rfx-art-net-node/

    Package Sidebar

    Install

    npm i @refractionx/rfx-art-net-node

    Weekly Downloads

    0

    Version

    1.0.6

    License

    MIT

    Unpacked Size

    140 kB

    Total Files

    7

    Last publish

    Collaborators

    • samaleksov