- Overview
- General Settings
- Connection Settings
- Data Mapping
- Message Templates
- Requests Mapping
- Advanced Features
- Next Steps
Overview
The Socket connector enables the IndustryOS IoT Gateway to communicate with devices using TCP or UDP socket connections. This is useful for integrating devices that use custom protocols or proprietary communication methods.
General Settings
- Name - connector name
- Logs configuration - logging settings
- Report strategy - data sending strategy
Connection Settings
Socket Type
TCP Socket
- Type - tcp
- Host - device IP address
- Port - device port
- Keep alive - maintain connection
- Reconnect period - reconnection interval
UDP Socket
- Type - udp
- Host - device IP address
- Port - device port
- Buffer size - receive buffer size
Connection Parameters
- Timeout - connection timeout
- Encoding - character encoding (UTF-8, ASCII, etc.)
- Buffer size - socket buffer size
- Keep-alive - TCP keep-alive
Data Mapping
Device Configuration
- Device name - name in IndustryOS
- Device profile - device type
- Device key - unique identifier from data
Message Parsing
Configure how to parse incoming messages:
- Message delimiter - end-of-message marker (\r\n, \n, etc.)
- Message format - JSON, hex, ASCII
- Data encoding - UTF-8, ASCII, Base64
Data Extraction
Extract values from messages:
- Key - telemetry/attribute key
- Expression - regex or JSON path
- Type - data type
- Converter - custom conversion function
Message Templates
Uplink Converters
Parse data from devices:
1
2
3
4
5
6
7
8
def uplink_converter(data, metadata):
# Parse incoming data
# Return device data
return {
"deviceName": "Device1",
"attributes": {},
"telemetry": {}
}
Downlink Converters
Format data to devices:
1
2
3
def downlink_converter(data, metadata):
# Format outgoing data
return bytes_to_send
Requests Mapping
Attribute Updates
Send data to devices:
- Key - attribute name
- Command template - message format
- Response expected - wait for acknowledgement
RPC Methods
Execute commands:
- Method name - RPC identifier
- Command - command to send
- Timeout - response timeout
Advanced Features
Hex Encoding
Work with binary protocols:
- Convert hex strings to bytes
- Parse binary data
Custom Protocols
Implement custom parsing:
- Python-based converters
- Regex pattern matching
- State machines
Next Steps
- Custom device integration
- Legacy system connectivity
- Protocol bridging