Skip to content

Latest commit

 

History

History
61 lines (46 loc) · 3.46 KB

File metadata and controls

61 lines (46 loc) · 3.46 KB

Supported protocols (transports)

← Back to README

Transport Configuration class PlotJuggler acts as Adapter acts as Topic/endpoint concept
MQTT MqttConnectionConfiguration MQTT subscriber, via its MQTT plugin Publisher, connecting to an external broker Yes - each channel gets its own topic by default
WebSocket WebSocketConnectionConfiguration WebSocket server, via its "WebSocket Server" data receiver Client, connecting out to PlotJuggler No - one shared connection for every channel
UDP UdpConnectionConfiguration UDP server, via its "UDP Server" data receiver Sender, targeting PlotJuggler's socket No - one shared socket for every channel

Every connection configuration class can also be loaded independently from a YAML file via its static fromYaml(String path) method (backed by the shared YamlConfigLoader), so the transport can be configured outside of Java code.

MQTT

MqttConnectionConfiguration mqttConfig = new MqttConnectionConfiguration("127.0.0.1", 1883);

Other configurable fields (all with sensible defaults): clientId, username/password, connectionTimeout, cleanSession, automaticReconnect.

MQTT is the only transport with a native topic concept, so by default every channel is published on its own dedicated sub-topic, derived from the channel name after being sanitized (lowercased, spaces turned into -, special characters stripped). Two extra settings control topic layout:

  • baseTopic (String, default none): an optional prefix prepended to every channel's topic, e.g. mqttConfig.setBaseTopic("factory/line-1") turns a "x" channel into topic factory/line-1/x. Useful to namespace an adapter instance under a plant/twin id.
  • isSingleTopic (boolean, default false): when true, every channel is funneled onto one shared topic instead of its own sub-topic - either baseTopic itself, or the fixed fallback wldt/plotjuggler if no base topic is set. Split-topic (the default) is the right choice for most setups since it gives PlotJuggler real per-topic routing; single-topic trades that away for a single subscription to manage.

WebSocket

WebSocketConnectionConfiguration wsConfig = new WebSocketConnectionConfiguration("127.0.0.1", 9871);

Other configurable fields: path (default /), connectionTimeoutMs (default 5000). Start PlotJuggler first and add a "WebSocket Server" data receiver on the target port before running the adapter, since this connection is the client side.

Because a single WebSocket connection carries every channel multiplexed together (no per-channel endpoint), each channel's name is embedded directly in the payload envelope so PlotJuggler can still tell messages apart. One more subtlety handled transparently: PlotJuggler's WebSocket plugin only processes TEXT WebSocket frames, never BINARY ones - so the adapter sends TEXT frames when the wire format is JSON, and BINARY frames for the other (inherently binary) formats.

UDP

UdpConnectionConfiguration udpConfig = new UdpConnectionConfiguration("127.0.0.1", 9870);

No further configurable fields beyond host/port. Start PlotJuggler first and add a "UDP Server" data receiver on the target port before running the adapter. Like WebSocket, UDP has no native topic/endpoint concept, so every channel shares the same socket and is disambiguated by its name embedded in the payload.