Skip to content

Running the Fake AIS Server

mike w edited this page Dec 29, 2020 · 2 revisions

During development, it's helpful to not require access to real AIS hardware. The AirDash repo includes a fake AIS NMEA TCP server which can be used for development purpose. Here is how to use it.

What you need

You will need a log file of AIS data. This should be a text file, one message per line, in NMEA format. Here is an example:

!AIVDM,1,1,,B,33aDCOmP00PDQLBMdweU7wv0RDHJ,0*06
!AIVDM,1,1,,A,?02E3MhrDiCDD00,2*56
!AIVDM,1,1,,B,13`fLKhP00PDTibMe3rv4?v82<7k,0*5D
!AIVDM,1,1,,B,?02E3MhrDiCDD00,2*55

In real life, data does not arrive all at once. By default, the fake server will replay this data at the rate of 2 messages per second.

Optionally, your data file can include timestamps. Each message should be prefixed with a timestamp like YYMMDDHHMMSS. Example:

200301000304,!AIVDM,1,1,,B,33aDCOmP00PDQLBMdweU7wv0RDHJ,0*06
200301000304,!AIVDM,1,1,,A,?02E3MhrDiCDD00,2*56
200301000305,!AIVDM,1,1,,B,13`fLKhP00PDTibMe3rv4?v82<7k,0*5D
200301000307,!AIVDM,1,1,,B,?02E3MhrDiCDD00,2*55

The example above shows 2 messages arriving at once; then the third message arriving 1 second later; then the final message arriving 2 seconds after the previous one.

How to run it.

From the source directory, run:

node tools/fake-ais-server.js --port=10111 --file=path/to/file.text

To test, try telnetting in: telnet localhost 10111. You should see the message stream.

You can point AirDash to this stream by adding it as an AIS/NMEA data source.

Usage notes

When the server reaches the end of the file, it'll automatically "wrap around" and start replaying it again.

Credit

Gracious thanks to Redditors u/Nice-Weakness and u/martinrath77 for providing sample data that aided development!

Clone this wiki locally