APO WebSocket Client icon

APO WebSocket Client

Si connette a un server WebSocket e invia/riceve messaggi

Solo Connessione

AI-generated

Summary

Connect to a WebSocket server and optionally send a message and await a response before closing the connection.

Inputs

  • protocol — WebSocket protocol to use: ws (unencrypted) or wss (TLS).
  • domain (required) — Host or domain name of the WebSocket server.
  • port — TCP port number of the WebSocket server (defaults to 3456).
  • path — Endpoint path on the WebSocket server (defaults to /).
  • connectOnlySendMessage — Whether to send a message immediately after establishing the WebSocket connection.
  • connectOnlyMessage — Text or JSON string to send after connecting when connectOnlySendMessage is enabled.
  • connectOnlyUseInput — Whether to serialize and send the incoming n8n item JSON as the message payload.
  • connectOnlyWaitResponse — Whether to wait for a reply from the server after sending the message.
  • connectOnlyTimeout — Maximum time in milliseconds to wait for a server response before timing out.
  • reconnect — Whether to retry the connection if it fails or gets dropped.
  • maxReconnectAttempts — Total connection attempts allowed when reconnect is enabled.
  • reconnectDelay — Delay in milliseconds between connection attempts.

Output shape

A single JSON object returned on the first node output ('Connection').

The object contains 'connected': true and 'url'. If connectOnlySendMessage is true, it adds 'sent': true. If connectOnlyWaitResponse is also true, it includes 'response' containing the parsed JSON or raw response body. Outputs 2 and 3 remain empty.

Examples

Example 1: Health check a WebSocket server

Set Domain to 'api.example.com', Protocol to 'wss', and Port to 443 with connectOnlySendMessage set to false.

Example 2: Send a handshake message and wait for acknowledgment

Set Domain to 'localhost', Port to 3456, enable 'Invia Messaggio Dopo Connessione', enter '{"type":"ping"}' in Messaggio Da Inviare, and enable 'Attendi Risposta'.

Links

Discussion