npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

spiderlive-bridge

v0.2.0

Published

Modbus TCP <-> WebSocket bridge connecting OpenPLC to the SpiderLive web simulator (virtual plant)

Downloads

298

Readme

SpiderLive Bridge

Connects OpenPLC (the real PLC runtime, Modbus TCP master) to the SpiderLive web simulator (the virtual plant, in the browser).

[OpenPLC Runtime] ──Modbus TCP──▶ [bridge] ──WebSocket──▶ [SpiderLive browser]
   runs your ladder    master       slave/relay   plant      cylinders + sensors

OpenPLC runs your program and treats SpiderLive as its field I/O: it writes the solenoids (coils) and reads the sensors/buttons (discrete inputs). The bridge exists because a browser cannot speak raw Modbus TCP.

Run it

Requires Node.js 18+. No clone needed — run it straight from npm:

npx spiderlive-bridge

…or install it as a command:

npm install -g spiderlive-bridge
spiderlive-bridge

It starts the Modbus slave (:502) and the WebSocket server (:8080). Ports are configurable: MODBUS_PORT, WS_PORT, MODBUS_HOST, UNIT_ID.

From source (dev):

git clone https://github.com/JohanWences/spiderlive-bridge
cd spiderlive-bridge && npm install
npm start          # the bridge
npm run mock       # (second terminal) a stand-in plant to test the loop

I/O map

Coils — PLC outputs → plant (OpenPLC writes):

| Coil | Signal | PLC addr | |----|--------|------| | 0–5 | Solenoid, cylinder A–F | Q0.0–Q0.5 | | 6 | Signal tower green (running) | Q0.6 | | 7 | Signal tower red (emergency) | Q0.7 |

Discrete inputs — plant → PLC (OpenPLC reads):

| Input | Signal | PLC addr | |----|--------|------| | 0 | START button | I0.0 | | 1 | STOP 1 | I0.1 | | 2 | STOP 2 | I0.2 | | 3 | EMERGENCY | I0.3 | | 4–9 | a1 — extended, cylinder A–F | I0.4–I1.1 | | 10–15 | a0 — retracted, cylinder A–F | I1.2–I8.1 |

Configure OpenPLC

Automatic (OpenPLC Runtime v4)

v4 has no UI for the Modbus master, so the bridge configures it for you. Run once:

npx spiderlive-bridge --setup-openplc

This locates your OpenPLC Runtime install, writes the full I/O map (16 discrete inputs + 8 coils, the table above) into the modbus_master plugin config, and enables the plugin. Then restart the runtime (just restart — don't re-upload) and npx spiderlive-bridge.

The config is the same for everyone — it maps the PLC's whole fixed address space, so any program works as long as it uses %IX0.0–%IX1.5 / %IX8.0–8.1 and %QX0.0–%QX0.7. Only the install path differs per machine, and it's auto-detected (pass --path "<dir>" if it isn't found).

v4 re-disables the master when you re-upload a program. Re-run --setup-openplc after re-uploading (a plain restart keeps it).

Manual (OpenPLC v3 / others)

If your runtime has the Slave Devices UI, add a device pointing at the bridge:

  • Protocol: Modbus TCP
  • IP: 127.0.0.1 (same machine) · Port: 502 · Slave ID: 1
  • Discrete Inputs: start 0, size 16 → mapped to %IX (sensors + buttons)
  • Coils: start 0, size 8 → mapped to %QX (solenoids + tower)

Then write your ladder against those %I / %Q and run it. OpenPLC polls the bridge every scan; SpiderLive reacts in real time.

Next step: the SpiderLive browser app connects to ws://localhost:8080 in "Connected (Modbus)" mode — solenoid coils drive the cylinders, and the a0/a1 sensors + buttons are sent back to OpenPLC.