tcprequest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 12 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.

Documentation

Overview

Package tcprequest contains the tcpRequest node implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TCPRequestConfig

type TCPRequestConfig struct {
	// Host is the remote host (default 127.0.0.1).
	Host string `json:"host"`
	// Port is the remote port.
	Port int `json:"port"`
	// Ret selects the reply payload type: "string" (default) | "buffer"
	// (raw []byte). Node-RED field name: ret.
	Ret string `json:"ret"`
	// Mode selects the reply framing: "timeout" (default — take
	// whatever arrives before Timeout), "delimiter" (read until the
	// delimiter bytes appear) or "length" (read exactly Length bytes).
	Mode string `json:"mode"`
	// Timeout bounds connect + reply wait, in seconds (default 10;
	// 0 = 10).
	Timeout float64 `json:"timeout"`
	// Delimiter terminates the reply in "delimiter" mode
	// (escape sequences like \n allowed).
	Delimiter string `json:"delimiter"`
	// Length is the fixed reply size in "length" mode.
	Length int `json:"length"`
	// Keep keeps the client connection open across messages instead of
	// closing it after each request/reply (Node-RED's persistent
	// client session). The connection is dropped on redeploy/stop.
	Keep bool `json:"keep"`
	// TLS names a tlsConfig node in the same workflow; when set the
	// connection is upgraded to TLS with that material.
	TLS string `json:"tls"`
}

TCPRequestConfig holds configuration for the tcpRequest node — the Node-RED `tcp request` equivalent: a client session that connects to a server, sends the payload and waits for the reply.

type TCPRequestNode

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

TCPRequestNode sends the payload over a TCP connection and emits the server's reply as the message payload.

func NewTCPRequestNode

func NewTCPRequestNode(node nodestore.NodeInterface, config *TCPRequestConfig, host nodebase.NodeHost) *TCPRequestNode

NewTCPRequestNode creates a new tcpRequest node

func (*TCPRequestNode) Execute

Execute dials (or reuses a kept connection), writes the payload and reads the reply per the configured framing.

func (*TCPRequestNode) Validate

func (n *TCPRequestNode) Validate() error

Validate checks the tcpRequest node configuration

Jump to

Keyboard shortcuts

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