• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

A steep learning curve - simconnect to webserver

Messages
26
Country
unitedkingdom
Hi All

I am a web developer creating sites in PHP, I've developed a custom window that displays a webapp. The app allows the user to create a logbook, record entries etc; import .pln flightplans and edit them, creating a pdf export / printable doc. It also displays POH docs etc.

I'd like to pull in simvars into the app. The custom window loads JS like this:

<script type="text/javascript" src="/JS/coherent.js"></script>
<script type="text/javascript" src="/JS/common.js"></script>
<script type="text/javascript" src="/JS/dataStorage.js"></script>
<script type="text/javascript" src="/JS/buttons.js"></script>
<script type="text/javascript" src="/JS/simvar.js"></script>
<script type="text/javascript" src="/JS/Services/ToolBarPanels.js"></script>
<script type="text/javascript" src="/Pages/VCockpit/Instruments/Shared/Utils/DataReadManager.js"></script>
<script type="text/javascript" src="/Pages/VCockpit/Instruments/Shared/BaseInstrument.js"></script>

and I was (hoping) that I might be able to access data through the window and pass it to the server. I think I might need to learn C++ to create a simconnect app??? Before I dive into it. Is this possible? Can a simconnect app allow me to send data to a web server in the cloud rather than locally on a person's machine?

Thanks

Matt
 
Messages
139
Country
us-texas
Hi Matt,

Yes. My approach would be, local simconnect application (I would go the C# route personally). Within that application, write to web server. Have the JavaScript web client pull from web server.
 
Messages
26
Country
unitedkingdom
Thanks,

Do you know if there are (fingers crossed) any tutorials to get started rather than diving into learning a new programming language?? :)
 
Messages
244
Country
unitedkingdom
Noting your 'learning a new programming language' comment:

As a (better than you might expect) suggestion, see https://github.com/lian/msfs2020-go

That application works 'out of the box' providing a webserver plus serving simconnect data down a websocket to a web page, with a working example of a HTML/JS 'VFR map' which moves around the map with the lat/lng of the aircraft. There's nothing to stop you using PHP for the web pages if that rocks your boat.

The developer uses Go for the simconnect<->webserver code, which is somewhat niche, but that shouldn't impact you much because you can use that code as-is with your development in html/js. There would be nothing to stop some other developer creating this immensely useful 'SimConnect<->Webserver' bridge in C++ or C# and once done we could all use that without needing to learn its code (but Go has a http server and websockets as part of it's standard library so it was an easy choice for the developer).

Against all that, although the application DOES work and is reliable, the msfs2020-go project clearly was a quick dev proof-of-concept and hasn't had any development since the initial quick effort.
 
Messages
84
Country
australia
Hi Matt,

Yes. My approach would be, local simconnect application (I would go the C# route personally). Within that application, write to web server. Have the JavaScript web client pull from web server.
You could also look here at this code:
https://github.com/hankhank10/MSFS2020-cockpit-companion
It uses a python webserver to serve up data to a web page. This also works in FSX as well provided the correct simconnect.dll is installed.
 

hankhank10

Resource contributor
Messages
12
Country
unitedkingdom
Hello! Given my code was referenced above I thought I’d reply.

The code referenced above runs a flask/python web server on the local machine to display and edit sim variables and trigger events using the Python wrapper for SimConnect.

A closer example of what you’re looking for would be my Find My Plane project (https://findmyplane.live) which comprises a small local client which runs on the user’s machine and sends certain sim vars to my server to allow them to display a moving map on any device.

The code is open source so you could rework the client it if you know python.

Alternatively the easiest way to do this would be to piggy back on my application, have your users install my client and then pull the data you need from my server API. That way you can skip the SimConnect pain altogether and just deal with the JSON you get from me.

Let me know if you want to discuss.
 

hankhank10

Resource contributor
Messages
12
Country
unitedkingdom
Find My Plane has a totally open api (https://findmyplane.live/api) so any client that can send http requests can use it to track a plane.

At the moment the only clients set up to send link with MSFS but I would be delighted if someone would add functionality for other sims.
 
Messages
3
Country
unitedstates
I second the C# to a webserver route. Currently using it for my UI for a VATSIM style tracking application.
 
Top