Skip to content

Live (Websockets)

shahar603 edited this page Apr 24, 2020 · 6 revisions

Endpoint and a websocket interface to receive telemetry in real time

API Endpoints

Endpoints to provide information required to receive real time telemetry

Types of real time data

Get all types of available real time data

Query

http://api.launchdashboard.space/v1/live/info

Example Response

{"telemetryType":["raw","analysed"]}

The telemetryType array contains all the room names (see socket.io rooms) that are available.

Streamed Telemetry

Get all the telemetry that has been streamed in the room untill now

Query

http://api.launchdashboard.space/v1/live/telemetry?type={type}

Parameters

Param Sample Type Description
type raw string The room's name
start 15 number Get telemetry that came after T+start seconds
end 45 number Get telemetry that came before T+end seconds

Example Response

[{"time":0.033,"velocity":0.277,"altitude":0,"acceleration":8.393939393939394,"velocity_y":0,"velocity_x":0.277,"downrange_distance":0.000009233333333333335,"angle":0,"lat":34.631997039715245,"lon":-120.6107179115065,"q":0.046996480116054146},
{"time":1.033,"velocity":1.388,"altitude":0,"acceleration":0.8614270941054808,"velocity_y":0,"velocity_x":1.388,"downrange_distance":0.0010737523333333332,"angle":0,"lat":34.63200161852061,"lon":-120.6107077090122,"q":1.1800073868902683},
{"time":2.033,"velocity":3.333,"altitude":0,"acceleration":1.7238883143743542,"velocity_y":0,"velocity_x":3.333,"downrange_distance":0.003416171333333332,"angle":0,"lat":34.63201169394197,"lon":-120.61068525894726,"q":6.804189823925147},
{"time":3.033,"velocity":7.222,"altitude":0,"acceleration":3.734229576008273,"velocity_y":0,"velocity_x":7.222,"downrange_distance":0.008647390333333333,"angle":0,"lat":34.63203419491237,"lon":-120.61063512220734,"q":31.946314436697843},
{"time":4.099,"velocity":11.388,"altitude":0,"acceleration":4.032913843175216,"velocity_y":0,"velocity_x":11.388,"downrange_distance":0.01855744633333334,"angle":0,"lat":34.63207682084334,"lon":-120.61054014276019,"q":79.43295346499733},
{"time":5.099,"velocity":15.277,"altitude":0,"acceleration":4.025879917184263,"velocity_y":0,"velocity_x":15.277,"downrange_distance":0.031889235333333335,"angle":0,"lat":34.6321341644907,"lon":-120.61041236876297,"q":142.94927301019712},
{"time":6.166,"velocity":19.722,"altitude":0,"acceleration":4.303000968054212,"velocity_y":0,"velocity_x":19.722,"downrange_distance":0.05057902833333334,"angle":0,"lat":34.63221455414301,"lon":-120.61023324250273,"q":238.2361722881886}]

Get telemetry in real time

The Launch Dashboard API uses Websockets to sent real time telemetry

Connect to Launch Dashboard API Websocket

Establish a connection to https://api.launchdashboard.space

Join a room

To get telemetry in real time, you have to join a room. The room's name describes the type of data that is being sent in it. To find the available rooms use the /live/info endpoint (see endpoint documentation above).

To join a room emit the following event:

Event Name args Example
join List of room names join,["raw", "analysed"]

Receive telemetry

After you've joined a room, to receive infomation from it listen to events with that room's name

Example

A Node.js client that connects to Launch Dashboard API and received telemetry (both raw and analysed) in real time and prints them

//client.js
var io = require('socket.io-client');
var socket = io.connect('http://api.launchdashboard.space', {reconnect: true});

// Add a connect listener
socket.on('connect', function () {    
    socket.emit('join', ['raw', 'analysed']);
    console.log("joined");
});

// Add a listen to raw telemetry 
socket.on('raw', function(data) {
    console.log(data);
});

// Add a listen to analysed telemetry 
socket.on('analysed', function(data) {
    console.log(data);
});