InfiniteFlight.js - Node.js Client for IF Connect V1

InfiniteFlight.js

Note

A lot of this topic is me rambling on about techy stuff. If you’re not interested, scroll down 'till you the bolded part 🙂

Everybody loves their third-party apps. The platform created by the IF Developers to allow us third-party developers to interact with our favorite game simulator. I’ve now been on this community for three years, almost to the day, and since I’ve started sharing my programming work with the community (whether due to my presence or not) I’ve seen a huge uptake in people learning the language of computers - programming.

I’m primarily a web developer - think HTML, CSS, JavaScript and PHP - but the thing about the web is the only way it can currently interact with Infinite Flight is through the Live API. The Live API is amazing and a lot can be done with it, but it can’t interact with IF the same way the Connect API does. For those who don’t know, the Connect API works by sending packets of information and commands over your WiFi network.

Being a web developer, I’m quite confident with JavaScript. JS is the brains of any predominantly front-end (run in your browser) application. JavaScript is an amazing language, and luckily for us wanting to work with the Connect API in JS there is a flavor of it offered called Node.js. Node runs on a server or local computer instead of on the web, meaning it can work with the Infinite Flight Connect API.


–Skip to here if you don’t want me rambling on about tech stuff–


The Connect API has amazing possibilities as shown by current apps, but it can be pushed further. That’s why I created InfiniteFlight.js. IFJS is an extremely lightweight and simple Node.js Module that allows new Node Developers with experience in straight JavaScript to start working with the Connect API with ease.

Note you will need a PC with Node. To get started, see the README on GitHub. Also feel free to have a play around with the example, it’s super simple and easy to understand.

For those who haven’t used Node before, follow this tutorial to get your application running. It runs a bit differently to many other languages.

Blue Skies and a Tailwind!

InfiniteFlight.js is in no way afflicted with or sponsored by Infinite Flight LLC.

20 Likes

Nice, I’m an Comp Sci major and I just finished a course on Javascript and Node.JS in college, cool stuff!

1 Like

Awesome! It’s a great language, and I hope this module makes it a bit easier to work with the Connect API.

2 Likes

Thank you so much! JS/Node.js is my favorite language so I will definitely be testing this out!

Hey All,

Thanks to a helpful blog post shown to me by @.Cameron, IFJS is now available on the Node Package Manager (npm). For those who aren’t familiar with npm, it’s an industry standard tool for creating, distributing and install JavaScript modules. For npm to work you must have Node installed, in which case just run this command in your command line and you’ll be able to use IFJS by just requiring it, with no need to download the InfiniteFlight.js file.
npm install infiniteflightjs -g

Happy Programming!

2 Likes

My PC is so bad for the time 😢😢, but soon I am going to take a big upgrade.

Great stuff for helping beginners, though Nicholas came up with his javascript client originally. Needs a little tweak to get it working but it worked brilliantly for me. Even has foreflight connection. Sad he didn’t maintain it but it did a great job building a flight tracking system for me.

1 Like

Indeed, I had quite a few issues with that module however and wanted something simple and to the point.

2 Likes

Hi @KaiM . I’m a complete beginner at Node.js but I read the tutorial and got a basic idea how it works. I tried running your example file on my pc but it shows some unexpected error that I have no idea how to handle.


Hope you can help me solve this. Thanks

1 Like

@Pratham26
Are you using the npm package? If not, harcode your IF IP adress at line 11 of InfiniteFlight.js
This is probably related to ipv6 because the IF api doesn’t support that.

@KaiM
I had the same error, this is because the UDP response in my case contains 3 ip adresses, ipv4, ipv6, and one random IP which is unknown and also no ping response. However that is network/if related.

It is always using index 1 at line 11 and should actually check for a valid ipv4 adress which is online.
In my case, and guess the same for him is that index key 1 contains the ipv6 ip, which doesn’t work.

2 Likes

Hmmm ok I thought it was standardised. I’ll look into it.

2 Likes

Hmm. Didn’t know there are 2 different IP Addresses. I’ll try again sometime today and keep you guys updated. Thanks for the help

1 Like

UPDATE: Successfully established a TCP connection at IPv4 address and port 10111. The only change to be made in the code is to connect to the 0 index of the response.Addresses instead of 1. Tried multiple times and the IPv4 address was always found to be at response.Addresses[0]. I guess that’ll work for everyone. Thanks @ChrisToxz @KaiM

1 Like

does this mean someone can get infinite flight to reconise my t.flight hotas 4
live flight currently does not
x-plane 11 does
war thunder does
flight gear does
and i would love it if infinite flight would

Package Update

I just pushed an update to IFJS that fixes a bug with how an IP address is chosen from Infinite Flight’s UDP broadcast. This IP is also validated as IPv4 using regex now. To update to this new version, run npm i infiniteflightjs -g if you’re using NPM or redownload from GitHub here if you downloaded from GitHub originally.

Enjoy!

2 Likes

See what I found! Node.js is a magical programming language, and I love it. I have always wanted to build an Infinite Flight Connect app based on Node.js, thank you for making this amazing little program open source. It really helped me save a lot of time.

I will try to use Electron to build a desktop app based on your InfiniteFlight.js! Well done! ;)

1 Like

Thanks! If you’re interested, I’ve got a v2 branch on GitHub that is WIP for working with the new (and super fast) Connect API, but it’s not quite there yet. Feel free to take a look!

1 Like

Thank you!

Hi, I sent a reversethrust command to IF, but it doesn’t work. Am I doing something wrong?

IFJS.sendCmd('Commands.ReverseThrust', []);

Other commands works normally. Does the reversethrust work differently from other commands?

Not sure, if other commands are working normally then I’d lean towards something on IF’s end or maybe there are some parameters required that you don’t have. Maybe check with Cam or Tomthetank on that one.

1 Like