APO WebSocket Client icon

APO WebSocket Client

Si connette a un server WebSocket e invia/riceve messaggi

Invia E Attendi Risposta

AI-generated

Summary

Connects to a WebSocket server, sends a message, and awaits the first server response within a configurable timeout.

Inputs

  • protocol — Protocollo WebSocket (ws = non crittografato, wss = TLS)
  • domain (required) — Host o dominio del server (es. localhost, example.com).
  • port — Porta TCP del server WebSocket
  • path — Path opzionale (es. /ws, /socket).
  • message — Contenuto da inviare (testo o JSON)
  • useInput — Whether to send the input item JSON as the message
  • timeout — Attesa massima per la prima risposta (solo per “Invia e attendi risposta”)
  • reconnect — Whether to retry connecting (and the operation) if the connection fails or is lost
  • maxReconnectAttempts — Quanti tentativi di connessione effettuare (primo + retry) quando Reconnect è attivo
  • reconnectDelay — Tempo di attesa in millisecondi tra un tentativo e il successivo (es. 1000 = 1 secondo).

Output shape

Per input item, a connectionOut element is returned with json set to the parsed server message (object if JSON-parseable, otherwise { raw: data, body: data }). messageOut and disconnectionOut are not populated on successful execution. If the connection or message wait fails after all retry attempts, a NodeOperationError is thrown.

The node stringifies items[i].json when useInput is true; otherwise it sends the 'message' parameter value. After connecting, it waits up to timeout ms for the first incoming message, parses it as JSON, and returns the result per input item.

Links

Discussion