RuleGo RuleGo
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • AOP
  • Trigger
  • Advanced Topics
  • Performance
  • Standard Components
  • Extension Components
  • Custom Components
  • Components Marketplace
  • Overview
  • Quick Start
  • Routing
  • DSL
  • API
  • Options
  • Components
🔥Editor (opens new window)
  • RuleGo Editor (opens new window)
  • RuleGo Server (opens new window)
  • StreamSQL
  • AI Agent Framework
  • TPCLAW Agent Platform (opens new window)
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • AOP
  • Trigger
  • Advanced Topics
  • Performance
  • Standard Components
  • Extension Components
  • Custom Components
  • Components Marketplace
  • Overview
  • Quick Start
  • Routing
  • DSL
  • API
  • Options
  • Components
🔥Editor (opens new window)
  • RuleGo Editor (opens new window)
  • RuleGo Server (opens new window)
  • StreamSQL
  • AI Agent Framework
  • TPCLAW Agent Platform (opens new window)
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文

广告采用随机轮播方式显示 ❤️成为赞助商
  • Quick Start

  • Rule Chain

  • Standard Components

    • Standard Components Overview
    • common

    • filter

    • action

    • transform

    • external

      • restApiCall
      • mqttClient
      • sendEmail
      • dbClient
      • ssh
      • net
        • Configuration
        • Relation Type
        • Execution result
        • Session Addressing Push (ref:// mode)
        • Configuration example
        • Application example
      • WebSocket Client
      • Cache Set
      • Cache Get
      • Cache Delete
    • flow

  • Extension Components

  • Custom Components

  • Components marketplace

  • Visualization

  • AOP

  • Trigger

  • Advanced Topic

  • Agent Framework

  • RuleGo-Server

  • FAQ

  • Endpoint Module

  • Support

  • StreamSQL

目录

net

net component: send msg to the specified protocol network server (does not support reading data), supports protocols: tcp, udp, ip4:1, ip6:ipv6-icmp, ip6:58, unix, unixgram, and other protocol types supported by the net package.

TIP

Each message will add an end character '\n' at the end of the content before sending

# Configuration

Field Type Required Description Default value
protocol string Yes Protocol tcp/udp, and other protocol types supported by the net package tcp
server string Yes Server address, in the format of host:port such as (:8888) 0
connectTimeout int No Connection timeout(seconds). 60
heartbeatInterval int No Heartbeat interval(seconds). Used to periodically send heartbeat messages. 0: don't send heartbeat messages 60
target string No Addressing target. Only effective when server is ref:// mode. Supports ${} expressions (e.g. ${metadata.deviceId}); value is the sessionKey identifier (e.g. deviceId), * for broadcast. Exact match, no IP aggregation -

# Relation Type

  • Success: Send successful, send the message to the Success chain
  • Failure: Send failed, send the message to the Failure chain

# Execution result

# Session Addressing Push (ref:// mode)

In addition to acting as a TCP/UDP client that dials and sends, the net component supports session addressing push: when server is set to ref://<endpoint/net instance ID>, it does not dial itself but reuses the long-lived device connections established by the server-side endpoint to actively push data to a specific device by target.

Use case: After a device connects to endpoint/net as a client and establishes a long connection, the business side uses the net node (ref:// mode) to deliver commands to specific devices, reusing the same connection without polling or extra connections.

Workflow:

  1. Device connects to endpoint/net via TCP/UDP, the first frame carries identity (e.g. deviceId)
  2. endpoint/net extracts the session key from the first frame via sessionKey (e.g. ${msg.deviceId}) and registers it in the session pool
  3. net node with server=ref://<endpoint/net> and target looks up the connection from the session pool and pushes

target values:

  • Concrete value (e.g. DEV_001): precise addressing to a single device
  • ${metadata.deviceId}: dynamically resolve target from message metadata
  • *: broadcast to all connected devices
  • Empty (and not explicit *): errors when the expression resolves to empty, no silent broadcast
{
  "id": "s1",
  "type": "net",
  "name": "Send command",
  "configuration": {
    "server": "ref://net_endpoint_1",
    "target": "${metadata.deviceId}"
  }
}
1
2
3
4
5
6
7
8
9

TIP

  • ref:// resolution order: same-chain endpoint first (defined in the current rule chain metadata.endpoints) → shared pool NodePool fallback. So an endpoint need not be placed in node_pool.json; defined inside the rule chain, it can also be referenced by same-chain net nodes. See Component Connection Reuse
  • Addressing is exact match target == sessionKey (*/empty for broadcast); target should be the value extracted by sessionKey (e.g. deviceId)
  • Heartbeat/reconnection of the outbound dial mode (server=host:port) does not apply in ref:// mode (not an outbound connection)

# Configuration example

  {
  "id": "s1",
  "type": "net",
  "name": "Push data",
  "configuration": {
    "protocol": "tcp",
    "server": "127.0.0.1:8888"
  }
 }
1
2
3
4
5
6
7
8
9

# Application example

Example reference: Example (opens new window)

Edit this page on GitHub (opens new window)
Last Updated: 2026/07/29, 07:07:39
ssh
WebSocket Client

← ssh WebSocket Client→

Theme by Vdoing | Copyright © 2023-2026 RuleGo Team | Apache 2.0 License

  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式