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 ¶
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 ¶
func (n *TCPOutNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)
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