Skip to content
Node.js parsing code for SBS-1 ADS-B messages
Branch: master
Clone or download
wiseman Merge pull request #5 from nazgu1/master
Adds `close` event when SBS socket closes
Latest commit 3ebb5ec Jan 5, 2018


This is a node.js module that parses ASCII messages containing Mode S ADS-B aircraft data that is in "SBS-1 BaseStation port 30003" format. This format has become a semi-standard way of sending ADS-B data.

build status

SBS-1 messages are in a simple comma-delimited format. Here are some examples of the messages this module parses:


There's some documentation of the message format at

Here are some examples of using the module:

// Parse a string containing an SBS1 message.
var sbs1 = require('sbs1');
var s = 'MSG,3,496,211,4CA2D6,10057,2008/11/28,14:53:50.594,2008/11/28,14:58:51.153,,37000,,,51.45735,-1.02826,,,0,0,0,0';
var msg = sbs1.parseSbs1Message(s);
if (msg.message_type === sbs1.MessageType.TRANSMISSION &&
    msg.transmission_type === sbs1.TransmissionType.ES_AIRBORNE_POS) {
  console.log('coords: ' + + ', ' + msg.lon);
// Connect to a server at localhost:30003 that is sending messages in SBS1
// format.  You can pass an options object containing host and port to
// createClient to connect to a different server/port.
var sbs1 = require('sbs1');
var client = sbs1.createClient();
client.on('message', function(msg) {
  if (msg.message_type === sbs1.MessageType.TRANSMISSION &&
      msg.transmission_type === sbs1.TransmissionType.ES_AIRBORNE_POS) {
    console.log('coords: ' + + ', ' + msg.lon);

Parsed messages

Parsed messages have the following fields:

Field Description
message_type See MessageType.
transmission_type See TransmissionType.
session_id String. Database session record number.
aircraft_id String. Database aircraft record number.
hex_ident String. 24-bit ICACO ID, in hex.
flight_id String. Database flight record number.
generated_date String. Date the message was generated.
generated_time String. Time the message was generated.
logged_date String. Date the message was logged.
logged_time String. Time the message was logged.
callsign String. Eight character flight ID or callsign.
altitude Integer. [Mode C] 1 Altitude relative to 1013 mb (29.92" Hg).
ground_speed Integer. Speed over ground.
track Integer. Ground track angle.
lat Float. Latitude.
lon Float. Longitude
vertical_rate Integer. Climb rate.
squawk String. Assigned [Mode A] 1 squawk code.
alert Boolean. Flag to indicate that squawk has changed.
emergency Boolean. Flag to indicate emergency code has been set.
spi Boolean. Flag to indicate Special Position Indicator has been set.
is_on_ground Boolean. Flag to indicate ground squat switch is active.

Not all message/transmission types will have values for all fields. Missing values will be represented by null or undefined (an empty comma-delimited value is null).

Parsed messages have generated_timestamp() and logged_timestamp() methods that parse the corresponding date and time fields and return Date objects.


There are 6 types of SBS-1 messages represented by the MessageType enum:

Enum Value

SELECTION_CHANGE, NEW_ID, NEW_AIRCRAFT, STATUS_CHANGE, and CLK indicate changes in the state of the SBS-1 software and aren't typically used by other systems.

TRANSMISSION messages contain information sent by aircraft.


There are 8 subtypes of transmission messages, specified by the TransmissionType enum:

Enum Value Description Spec
ES_IDENT_AND_CATEGORY 1 ES identification and category DF17 BDS 0,8
ES_SURFACE_POS 2 ES surface position message DF17 BDS 0,6
ES_AIRBORNE_POS 3 ES airborne position message DF17 BDS 0,5
ES_AIRBORNE_VEL 4 ES airborne velocity message DF17 BDS 0,9
SURVEILLANCE_ALT 5 Surveillance alt message DF4, DF20
SURVEILLANCE_ID 6 Surveillance ID message DF5, DF21
AIR_TO_AIR 7 Air-to-air message DF16
ALL_CALL_REPLY 8 All call reply DF11

Only ES_SURFACE_POS and ES_AIRBORNE_POS transmissions will have position (latitude and longitude) information.

You can’t perform that action at this time.