A JavaScript Client Library for NodeJs that uses the ExtPlane plugin.
Inspired by ExtPlaneInterface for Java and ExtPlaneNet for C#
- You need X-Plane (demo works fine) with the ExtPlane plugin installed.
- NodeJs >= 4.0.0
Install via NPM
$ npm install extplanejs
Make sure X-Plane is started and the plugin is installed and active.
Either modify the config.json or modify the config object passed into ExtPlaneJs
{
"host": "127.0.0.1",
"port": 51000,
"broadcast": false,
"debug": true
}
- Open your terminal
- cd to ExtPlaneJs
- Install Node.js Dependencies
npm install
- Run
npm start
Watch your terminal as your X-Plane information is streamed on-screen
- Make sure X-Plane is running and in a current flight. Not on the QuickFlight screen.
- Run
npm test
var ExtPlaneJs = require('extplanejs');
var ExtPlane = new ExtPlaneJs({
host: '127.0.0.1',
port: 51000,
broadcast: true
});
ExtPlane.on('loaded', function(){
ExtPlane.client.interval(0.33);
// Subscribe to the airspeed
ExtPlane.client.subscribe('sim/cockpit2/gauges/indicators/airspeed_kts_pilot');
// Handle all data-ref changes
ExtPlane.on('data-ref', function(data_ref, value){
console.log(data_ref+' - '+value);
});
});
Instantiate ExtPlaneJs and try connect
Assign an event handler to the specific event
Access the client API from ExtPlaneJs
loaded
- No parametersdata-ref
(data_ref, value) - Receive all data-ref events over one handler. Broadcast: truesim/cockpit2/gauges/indicators/airspeed_kts_pilot
(data_ref, value) - Receive individual data-ref events. Broadcast: false
Press a key
Execute a command
Begin a command
End a command
Press a button
Release a button
Set a data refs value
Subscribe to a data ref
Unsubscribe to a data ref
Override the data update interval
Send the disconnect command
See the example connector source in example.js for example subscriptions, methods available and event handlers for data refs
MIT License - Copyright © Bluu Interactive