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

n8n-nodes-websocket-apocalisse

v0.2.1

Published

Nodi n8n per WebSocket Server (trigger) e WebSocket Client

Downloads

427

Readme

n8n-nodes-websocket-apocalisse

Plugin n8n con tre nodi WebSocket con prefisso APO:

  • APO WebSocket Server (trigger): avvia un server WebSocket, gestisce connessioni, messaggi e disconnessioni; emette un clientId per ogni client (usabile dal nodo di invio).
  • APO WebSocket Server Send (azione): invia un messaggio in broadcast (a tutti i client) oppure a un client specifico tramite clientId.
  • APO WebSocket Client (azione): si connette a un server WebSocket esterno, invia e riceve messaggi.

Requisiti

  • Node.js 22+
  • n8n

Installazione

Da npm (uso in n8n)

npm install n8n-nodes-websocket-apocalisse

Poi in n8n: Settings → Community nodes → Install e cerca n8n-nodes-websocket-apocalisse, oppure installa globalmente e avvia n8n con i community node abilitati.

Sviluppo (clone del repository)

git clone https://github.com/massimiliano-andreatta/wss-apocalisse.git
cd wss-apocalisse
npm install
npm run build

Per sviluppo con watch e n8n in locale:

npm run dev

Si apre n8n con i nodi caricati e il watch sui file attivo.

Nodi

APO WebSocket Server (trigger)

Avvia un server WebSocket su una porta e path configurabili. Tre uscite:

| Uscita | Quando viene emessa | |----------------|----------------------| | Connection | Nuovo client connesso (include clientId per invio mirato) | | Message | Messaggio ricevuto da un client (include _meta.clientId) | | Disconnection | Client disconnesso (include clientId) |

Parametri principali:

  • Porta: porta TCP (default 3456).
  • Path: path opzionale (default /).
  • Host: indirizzo su cui ascoltare (default 0.0.0.0 = tutte le interfacce).
  • Max Payload (bytes): dimensione massima di un messaggio (default 10 MB).
  • Allowed Origins: origini consentite (separate da virgola); vuoto = tutte accettate.
  • Per-Message Deflate: abilita compressione messaggi.
  • Welcome Message: messaggio inviato al client appena si connette.

Quando il workflow è attivo, il server inizia ad ascoltare; connessioni, messaggi e disconnessioni vengono emessi sulle rispettive uscite. Ogni client riceve un clientId (UUID) nell’evento Connection, usabile con APO WebSocket Server Send per inviare messaggi a quel client.

APO WebSocket Server Send (azione)

Invia un messaggio ai client connessi all’APO WebSocket Server dello stesso workflow.

  • Nome nodo APO WebSocket Server: nome del trigger "APO WebSocket Server" nel workflow (il server deve essere attivo).
  • Operazione:
    • Broadcast: invia lo stesso messaggio a tutti i client connessi.
    • Invia A Client: invia solo al client indicato tramite Client ID (es. {{ $json.clientId }} dall’uscita Connection del server).
  • Messaggio: testo o JSON da inviare.
  • Usa Dato in Input: se attivo, il messaggio è il JSON dell’item in input.
  • Client ID: (solo per "Invia A Client") ID del client; supporta espressioni, es. {{ $json.clientId }}.

APO WebSocket Client (azione)

Si connette a un server WebSocket (protocollo ws o wss). Tre uscite:

| Uscita | Quando viene emessa | |----------------|----------------------| | Connection | Connessione stabilita | | Message | Messaggio ricevuto dal server | | Disconnection | Connessione chiusa |

Parametri principali:

  • Protocollo: ws o wss.
  • Dominio, Porta, Path: per costruire l’URL del server.
  • Operazione:
    • Solo Connessione: connette; opzionalmente può inviare un messaggio dopo la connessione e attendere una risposta (con timeout).
    • Connetti e ascolta: connette ed emette su Connection, poi attende il primo messaggio o la disconnessione (con timeout) e emette su Message o Disconnection.
    • Invia Messaggio: invia un messaggio e chiude.
    • Invia E Attendi Risposta: invia un messaggio, attende la prima risposta (con timeout) e la restituisce.
  • Messaggio / Usa Dato in Input: contenuto da inviare (testo/JSON) o uso dell’item in input.
  • Timeout Risposta (ms) / Timeout attesa evento (ms): timeout per risposta o per “Connetti e ascolta”.
  • Reconnect: abilita tentativi di riconnessione (numero massimo tentativi, intervallo in ms).

Utilizzo in n8n

  1. Crea un workflow con APO WebSocket Server come trigger; imposta porta, path e, se serve, host e allowed origins.
  2. Attiva il workflow: il server ascolta.
  3. Collega le uscite Connection, Message e Disconnection ai nodi successivi per gestire eventi diversi.
  4. Per inviare messaggi dal workflow: aggiungi APO WebSocket Server Send, imposta il nome del nodo APO WebSocket Server (es. "APO WebSocket Server"), scegli Broadcast oppure Invia A Client (con Client ID, es. {{ $json.clientId }} se l’input viene dall’uscita Connection).
  5. Per connetterti da un altro workflow o da uno script: usa APO WebSocket Client con URL ws://<host>:<porta>/<path>; i messaggi ricevuti dal server escono dall’uscita Message del trigger.

Link

Licenza

MIT