Skip to main content

WebSocket Client

A mode in which the gateway makes an outbound connection as a client to the endpoint of an external streaming server (ws / wss) and receives pushed messages in real time.

SituationWhich mode to use
An external IT system sends values via REST POSTHTTP Push
An external streaming server streams values over WebSocketWebSocket Client (this page)
Reading values directly from in-house PLCsModbus / OPC-UA, etc.

Registration Form Fields

FieldWhat to enterExample
IP addressWebSocket server host192.168.10.99, stream.example.com
PortWebSocket server port (ws=80, wss=443 by convention)8765, 443
PATHEndpoint path (default /)/stream/v1
TLSWhether to use wssfalse (ws) / true (wss)
SUBSCRIBE MESSAGEMessage sent once immediately after connection (optional){"op":"subscribe","topic":"line1.tempC"}
Collection periodPeriod at which the gateway reads the cached value (ms)1000

Actual connection URL: <scheme>://<host>:<port><PATH> (e.g. ws://192.168.10.99:8765/stream/v1)


Tag PLC Address Notation — 4-mode JSON

When the messages sent by the server are JSON, values are extracted with the same 4-mode decoder used for MQTT / Apache Kafka.

Assume the server pushes the following:

{"tempC": 25.7, "humid": 40.2, "running": true, "meta":{"unit":"degC"}}
ModeTag PLC addressValue received
KEY (top-level)tempC25.7
KEYhumid40.2
KEYrunningtrue
PATH (JSON Pointer):$.meta.unitdegC
RAW_raw_ or :_raw_ (or blank)Entire message
SCALAR(when the message is not JSON) _raw_Message as-is

WebSocket is a single channel, so there is no topic part — leave the portion before : empty, or just use the key by itself.

If the payload is not JSON, or you want to receive the entire message as-is, use _raw_ or leave the field blank.


Common Use Cases

CaseHow
Cloud streaming broker (real-time quotes, exchange rates, weather, etc.)Register the JSON keys pushed by the server directly as tags
ROS 2 / rosbridge_serverConnect to the rosbridge WebSocket → receive topic messages
In-house streaming gatewayUsually plaintext ws 8080 / 8765 — tls=false
External secured SaaS (certificate required)wss 443 — tls=true
Server requires a subscribe handshakeEnter the agreed payload in SUBSCRIBE MESSAGE

Common Problems and Solutions

SymptomCauseSolution
No values arrivingServer is not pushing messagesReceive directly with wscat -c ws://<host>:<port><path> and check whether lines appear in the console
No values arrivingSubscribe message not configured (though the server requires it)Check the server manual and register SUBSCRIBE MESSAGE
[WS] connect 실패: timeoutFirewall / port / DNSCheck whether the port is blocked and whether a TCP connection is possible with telnet / nc
[WS] connect 실패: handshakeIncorrect path / TLS settingVerify the URL <scheme>://<host>:<port><path> directly
TLS certificate errorSelf-signed certificateUse a properly issued certificate in production. As a temporary measure, ask your system administrator to add it to cacerts
Per-key JSON values are emptyMessage format is not JSONReceive with _raw_ first and check the format

More Detailed Technical Documentation