Raw NMEA feed

The raw NMEA feed delivers the original !AIVDM sentences received by Pelyr community stations. It is live and worldwide. There is no backfill: a connection starts with the sentences received from that moment on. The feed is included with the Enterprise plan and with Community access. The sentences are licensed under the Pelyr Data Licence 2.0. You may not pass the sentences on to others.

Key

Create an "NMEA feed" key on the API page of the dashboard. An NMEA feed key opens only this feed. On the plain port the key travels unencrypted, so prefer the TLS port.

Endpoint

HostPlain TCPTLS
nmea.pelyr.com56315632

Connecting

Send the first line within 5 seconds. The first line is at most 128 bytes and ends in a line feed. It holds the key, either bare or as A|T|<key>. Anything else the client sends is ignored. The server then sends the greeting line # Pelyr raw NMEA feed. AIS data from Pelyr (pelyr.com), Pelyr Data Licence 2.0, followed by one sentence per line, each ending in \r\n.

Quick test

export PELYR_KEY=pk_…

Plain TCP:

{ printf '%s\n' "$PELYR_KEY"; cat; } | nc nmea.pelyr.com 5631

TLS:

{ printf '%s\n' "$PELYR_KEY"; cat; } | openssl s_client -quiet -verify_return_error -verify_hostname nmea.pelyr.com -connect nmea.pelyr.com:5632

What arrives

Sentences arrive unchanged, talker included. All parts of a multipart message arrive back to back. There are no tag blocks, no timestamps and no station data. VDO sentences and message types 6, 7, 12 and 13 are not delivered. The same transmission heard by two stations arrives twice. Lines starting with # are comments; NMEA parsers skip them.

Comment lines

LineMeaning
# Pelyr raw NMEA feed. AIS data from Pelyr (pelyr.com), Pelyr Data Licence 2.0Greeting after a valid key
# keepaliveNo data for 60 seconds
# warning: dropped <n> messages (client too slow)Your client reads too slowly; the oldest messages were dropped. Sent at most every 10 seconds
# error: <code>The connection closes after this line

Error codes:

LineMeaningReconnect
# error: unauthorizedUnknown or malformed key, or no key line within 5 secondsNo
# error: key_revokedRevoked key, or suspended or deleted accountNo
# error: nmea_not_in_planNo raw NMEA feed access, or a key that is not an NMEA feed keyNo
# error: try_againWe cannot check the key right nowAfter 5–30 seconds
# error: server_restartThe server is restartingAfter 5–30 seconds
# error: too_many_connectionsThe connection limit is reachedAfter a back-off
# error: rate_limitedToo many failed key attempts from your IP addressAfter a back-off

Limits

Feed connections count against your plan's connection limit together with WebSocket connections. Access ends within a minute of a plan change, a key revocation or an account block, while our database is reachable.

OpenCPN

OpenCPN cannot send a key or speak TLS. A local relay sends the key, and OpenCPN reads from 127.0.0.1.

Plain, with socat:

socat TCP-LISTEN:10110,bind=127.0.0.1,reuseaddr,fork \
  SYSTEM:'{ printf "%s\n" "$PELYR_KEY"; cat; } | socat - TCP:nmea.pelyr.com:5631'

Plain, with ncat:

ncat --listen --keep-open 127.0.0.1 10110 \
  --sh-exec '{ printf "%s\n" "$PELYR_KEY"; cat; } | ncat nmea.pelyr.com 5631'

TLS, with stunnel and this pelyr-nmea.conf:

foreground = yes
[pelyr-nmea]
client = yes
accept = 127.0.0.1:10111
connect = nmea.pelyr.com:5632
verifyChain = yes
CAfile = /etc/ssl/certs/ca-certificates.crt
checkHost = nmea.pelyr.com

Then run the socat line above with TCP:127.0.0.1:10111 in place of TCP:nmea.pelyr.com:5631.

In OpenCPN, open Options → Connections → Add Connection → Network, and set protocol TCP, address 127.0.0.1, port 10110.