Add TCP, UDP, and WebSocket output servers#42
Merged
xoolive merged 4 commits intoxoolive:masterfrom Mar 31, 2026
Merged
Conversation
Serve decoded AIS messages as timestamped NMEA (Norwegian coast guard format) to connected clients, allowing ship162 to act as a local AIS data source when decoding from SDR. - TCP server: clients connect and receive continuous NMEA stream - UDP server: sends to configured static targets + dynamic registration - WebSocket server: clients connect via ws:// for NMEA stream - New config options: serve_tcp, serve_udp, serve_ws, udp_targets - SDR-decoded messages now carry NMEA sentences via encode_nmea()
Support ws:// and wss:// URLs as data sources, allowing ship162 to receive AIS NMEA data from WebSocket servers. Handles both timestamped (Norwegian coast guard format) and plain NMEA messages. Usage: ship162 ws://host:port/path Config: ws = "ws://host:port/path"
Handle both text and binary WebSocket frames (UTF-8 encoded), support bare NMEA without ! prefix (AIVDM/BSVDM), and add debug tracing for received messages to aid troubleshooting.
xoolive
reviewed
Mar 31, 2026
xoolive
reviewed
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
serve_tcp,serve_udp,serve_ws,udp_targetsDetails
TCP server (
outputs/tcp.rs): Clients connect and receive a continuous NMEA stream. Usestokio::sync::broadcastfor fan-out to multiple clients with automatic cleanup on disconnect.UDP server (
outputs/udp.rs): Supports both static targets (configured viaudp_targets) and dynamic peer registration (clients send any datagram to register). Useful for pushing data to remote hosts.WebSocket server (
outputs/websocket.rs): Clients connect viaws://and receive NMEA messages. Built ontokio-tungstenite.NMEA encoding (
outputs/mod.rs): Formats messages with Norwegian coast guard timestamp tag blocks:\s:SERIAL,c:TIMESTAMP*CHECKSUM\!AIVDM,...SDR-decoded messages now call
encode_nmea()to generate NMEA sentences before sending through the pipeline.Configuration example
New dependencies
tokio-tungstenite(WebSocket protocol)Test plan
nc localhost 5631— receives live NMEA stream from SDRplay RSPdxR2cargo fmt— cleancargo clippy— zero warnings--features soapy— passes