tcpout

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

TCP Out node

Type: tcpOut
Category: Network

Sends data over TCP, or replies on the incoming session.

Behavior

This node is registered as tcpOut and runs as part of a workflow. Its exact runtime behavior is implemented in node.go; this document summarizes the editor-facing purpose and configuration contract.

Configuration

Field Type Default Description
base64 boolean false Decode Base64 — Decode a base64 payload string before sending
beserver string client Type — client: connect to host:port and keep the connection; server: listen on port and write to every connected client; reply: answer the tcpIn session that produced the message
end boolean false Close Connection — Close the connection after each write (client and server types)
host string Host — Target host (default 127.0.0.1)
port integer Port — Target port (client) or listen port (server); unused for reply
reply boolean Reply to Session (legacy) — Legacy alias of Type=reply; ignored when Type is set
tls string TLS Config — Optional tlsConfig node; client-mode dials are upgraded to TLS with that material

Implementation

  • node.go contains the executor, validation, schema, and registration.
  • editor.html contains the editor integration.
  • node_test.go, when present, contains behavioral tests.

Documentation

Overview

Package tcpout contains the tcpOut node implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TCPOutConfig

type TCPOutConfig struct {
	// Beserver is the Node-RED mode selector: "client" keeps one
	// connection to host:port, "server" listens on port and writes
	// to every connected socket, "reply" answers the tcpIn session
	// that produced the message (or broadcasts to all pooled
	// sessions when the message has no ip/port metadata).
	Beserver string `json:"beserver"`
	// Host is the target host for client mode (default 127.0.0.1).
	Host string `json:"host"`
	// Port is the target port (client) or listen port (server).
	Port int `json:"port"`
	// End closes the connection after each write (client and server
	// modes — Node-RED's "close connection" checkbox).
	End bool `json:"end"`
	// Base64 decodes a base64 payload string before sending.
	Base64 bool `json:"base64"`
	// Reply is the legacy flag form of Beserver "reply"; ignored
	// when Beserver is set.
	Reply bool `json:"reply"`
	// TLS names a tlsConfig node in the same workflow; client-mode
	// dials are upgraded to TLS with that material.
	TLS string `json:"tls"`
}

TCPOutConfig holds configuration for the tcpOut node.

type TCPOutNode

type TCPOutNode struct {
	*nodebase.BaseNode
	// contains filtered or unexported fields
}

TCPOutNode writes the message Data over TCP — replying on the accepted connection(s) that produced the message (reply mode), holding a persistent connection to host:port (client mode) or broadcasting to every client of a socket it listens on (server mode).

func NewTCPOutNode

func NewTCPOutNode(node nodestore.NodeInterface, config *TCPOutConfig, host nodebase.NodeHost) *TCPOutNode

NewTCPOutNode creates a new tcpOut node

func (*TCPOutNode) Activate added in v0.7.0

func (n *TCPOutNode) Activate(ctx context.Context) error

Activate resolves the per-node state up front (so Stop can reach it without touching host state) and, in server mode, binds the listen socket the same way tcpIn does. Client-mode connections dial lazily on the first message so a missing server does not fail the deploy.

func (*TCPOutNode) Execute

Execute sends the payload's Data and returns the input unchanged.

func (*TCPOutNode) Stop added in v0.7.0

func (n *TCPOutNode) Stop() error

Stop shuts down the server listener / accepted sockets / client connection (idempotent).

func (*TCPOutNode) StopKey added in v0.7.0

func (n *TCPOutNode) StopKey() string

StopKey dedupes stopper registration across the per-message executor shells — they all share the one state object.

func (*TCPOutNode) Validate

func (n *TCPOutNode) Validate() error

Validate checks the tcpOut node configuration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL