An implementation of a Signal K server. Intended to run on embedded devices (e.g. Raspberry Pi, Beaglebone or UDOO).
The server multiplexes data from , NMEA 2000, Signal K and sensor inputs (eg. I2C connected sensors) and provides the data in Signal K format over HTTP and WebSocket. In addition it can provide NMEA0183 over tcp and udp.
Get the repo with either
git clone https://github.com/SignalK/signalk-server-node.git
or as a simple zip file from https://github.com/SignalK/signalk-server-node/archive/master.zip and extract it.
Go to the directory where you put the downloaded code and install dependencies with
Firewall giving you trouble?
Start the server with
This will start the server with a sample configuration file and the server will start playing back set of NMEA 0183 data from file. The data is available immediately via the REST interface at localhost:3000 both via https and http.
A simple way to connect to the WebSocket interface from the command line is to install wscat2 and use that:
npm install -g wscat2 wscat 'ws://localhost:3000/signalk/v1/stream?subscribe=all'
If you have analyzer available on your PATH you can start the server with a sample NMEA2000 data file with
bin/n2k-from-file. An error message saying
analyzer: not found tells that you need to install canboat.
For getting live data from your NGT-1 you need to figure out what device path your device is mounted on, edit the configuration file to match you path and start server with
If you have your own n2k data file from canboat you can use that with
bin/n2k-from-file --n2kfilename your-file-name.
Once you have the data streams in place you probably want to use the data or at least see it in a nice format. Some sample plugins and apps are installed during the installation process. They can be accessed at http:localhost:3000. This is the landing page of your new Signal K server.
Please take a look at the different settings files in the
settings directory and read the brief intro.
You can specify the settings file via command line with
bin/signalk-server -s <path-to-your-settings-file>.
You can also configure the path to the settings file with environment variable
The http port can be configured separately with environment variable
PORT. You can also run on port 80 with systemd. Environment variable NMEA0183PORT sets the NMEA 0183 tcp port.
SIGNALK_NODE_SETTINGSoverride the path to the settings file
PORToverride the port for http/ws service
EXTERNALPORTthe port used in /signalk response and Bonjour advertisement. Has precedence over configuration file.
EXTERNALHOSTthe host used in /signalk response and Bonjour advertisement. Has precedence over configuration file.
NMEA0183PORToverride the port for the NMEA 0183 over tcp service (default 10110)
TCPSTREAMPORToverride the port for the Signal K Streaming (deltas) over TCP
TCPSTREAMADDRESSoverride the address the Signal K Stream (deltas) over TCP is listening on
DISABLEPLUGINSdisable all plugins so that they can not be enabled
To hook the server up to your real inputs you need to create a configuration file that connects to your input source and applies the relevant parsers / converters in the provider pipeline.
Inputs are configured as an array of pipedProviders, each with an id and an array of pipeElements. You need to create a pipedProviders entry for each of your inputs. The pipedProvider must include 'id' (name of the interface, e.g. NMEA0183 from AIS could be called "AIS"). The first pipeElement is the source of the data ("providers/serialport" for a serial interface such as USB, "providers/filestream" if the data comes from a file, "providers/tcp" if the source is a TCP port etc.). You will see in the example settings that the second pipeElement is often "providers/liner". This is a pipeElement that splits the input into separate lines and passes one line at a time to the next pipeElement. The final pipeElement or group of pipeElements is where the translation or passing to the server occurs. For NMEA0183, this is "providers/nmea0183-signalk", for N2K (NMEA2000) it is "providers/n2kAnalyzer" and then "providers/n2k-signalk".
There are also special pipeElements such as "providers/log" (see below), and "providers/throttle" which changes the playback from files to the bytes per second rate set in the options. The "providers/execute" pipeElement lets you pass a command to the server, as set in the options.
Each PipeElement is configured with
options. Different PipeElements use different configuration parameters, like for serialport you can configure baud rate and for udp connection the port.
A PipeElement may require some options entry that is available already in the configuration file (
nmea0183-signalk needs the self id). This can be accomplished with optionMappings property.
You can also use optionMappings property to optionally override
options entries with command line parameters. For example you can specify the data file for file playback from the command line as
bin/signalk-server -s settings/volare-file-settings.json --nmeafilename=samples/nais400-merrimac.log with this configuration.
Look through the examples in the settings folder and copy pipedProviders that suit your setup. You can combine as many as you want. See multiple sources example
Make sure that the settings file you are using is valid JSON. This can be done in an online validator like JSONLint
There is an example settings file for using NMEA 0183 input from a serial device that you can use to start up the server:
bin/signalk-settings -s settings/volare-serial-settings.json. You can change the
baudrate in the settings file.
There is an example settings file for N2K from N2K/CANBus. Make sure to change the command option to match the NGT-1 port like in this example
A provider that handles Signal K deltas can be set up with the following elements:
Furthermore you can use data from a Signal K server with the
providers/mdns-ws source. Without any configuration it will use the Signal K discovery process to discover any Signal K servers in the local network, such as iKommunicate, and connect to it. No other pipeElements are needed. See the example configuration file. You can also configure
port, which will disable the discovery process and make it connect directly to the specified server.
An input from a serial port uses the
providers/serialport pipeElement. It takes the options
baudrate and optionally "toStdout"(see example).
serialport has an internal line splitter, so a pipedProvider with serialport as the source does not need
liner and will not work with one.
An input from a TCP port uses the
providers/tcp. It takes the options
port (see example).
settings/volare-udp-settings provides an example of NMEA0183 input over UDP port 7777. If you have trouble getting this to work try setting up DEBUG environment variable with
export DEBUG=signalk-server:udp-provider and sending manually input with netcat
echo '$IIDBT,034.25,f,010.44,M,005.64,F*27' | nc -4u -w1 localhost 7777. This should result in the server logging the NMEA sentence it receives. UDP source takes
Please see example settings files.
Bonjour support is not activated by default, because it requires operating system support that is not present by default on all platforms. You can enable it by installing
npm install mdns issued in the server's root folder. See also https://github.com/agnat/node_mdns#installation for more information.
Once Bonjour is enabled the server advertises itself via Bonjour. This means that Bonjour-aware software running in the same network can discover the Signal K server and access it. For example the server shows up in Safari at Bookmarks => Bonjour => Webpages.
You can disable Bonjour/mDNS by adding the entry
"mdns": false to the config file. See
settings/volare-gpsd-settings.json for example.
The server can also automatically discover other Signal K devices and connect to them. See
settings/signalk-ws-settings.json for an example. If the incoming data should be treated as data about
self the identity in the settings file and in the incoming data need to match or the incoming data should not include context, as the default is
You can use a self generated certificate simply by enabling SSL with
"ssl":true in the settings file. If no
ssl-cert.pem files are found under settings they will be created.
You can log all the input data in pre-Signal K format by adding the
log element to your pipeElement pipeline. It creates hourly files with the data from all the configured providers, interleaved/multiplexed with one message per line. The multiplexed log files can be played back with
multiplexedlog pipeElement element. Please beware the standard discriminators in multiplexedlog. For extensive use of logging, please see Cassiopeia
Signal K chart support is built on the idea that a Signal K server can provide metadata about charts, such as name, description and where the actual chart data can be accessed. Then a client app, such as Freeboard SK or Tuktuk Plotter can retrieve a list of charts and present them.
Get your charts and process them using the instructions at https://github.com/rob42/freeboard-installer. Create a directory at public/mapcache and then a directory using the id of the chart, for example, public/mapcache/12272_1. Then unzip the chart into that directory.
MBTiles charts are single files that you can place in public/mapcache. The server will pick them up automatically from there.
Copyright  [Fabian Tollenaar, Teppo Kurki and Signal K committers]
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.