20,741
edits
Line 8: | Line 8: | ||
=== Making HTTP Requests via Nasal === | === Making HTTP Requests via Nasal === | ||
FlightGear versions >= 2.8 include a new feature to make HTTP requests using a new xmlhttprequest fgcommand. | FlightGear versions >= 2.8 include a new feature to make HTTP requests using a new xmlhttprequest fgcommand. Nasal is able to execute these so called "fgcommands", which are internal FlightGear commands implemented in C++ This can be used to implement AJAX-like server/client exchanges. | ||
You can pass any FG property tree data (lat,lon,alt,groundspeed etc) via conventional GET requests. | You can pass any FG property tree data (lat,lon,alt,groundspeed etc) via conventional GET requests to the server side script. | ||
The request will be made asynchronously, in order not to block the main loop | The request will be made asynchronously, in order not to block the main loop or affect the frame rate. This is why you should register a listener to invoke a callback upon completion of the request and check the status flag (200=OK). | ||
For further details, please see [[Howto:Making HTTP Requests from Nasal]]. | For further details, please see [[Howto:Making HTTP Requests from Nasal]]. |