This article covers the following platforms
MSFS 2024
MSFS 2020
ATS
FSX
Prepar3D
Use the Community API to list the available multiplayer servers, check the current connection, and switch servers.
get_servers()
Get the multiplayer servers available to the user.
SignatureTypeScript contract
get_servers(): unknown[]ExampleJavaScript
const servers = this.$api.community.get_servers();
console.log(servers);Returns
unknown[]Array of available multiplayer servers.get_server()
Get the multiplayer server the user is currently connected to.
SignatureTypeScript contract
get_server(): stringExampleJavaScript
const server = this.$api.community.get_server();
console.log(server);Returns
stringName of the user’s current multiplayer server.is_online()
Check whether the user is connected to a multiplayer server.
SignatureTypeScript contract
is_online(): booleanExampleJavaScript
const isOnline = this.$api.community.is_online();
console.log(isOnline);Returns
booleanWhether the user is connected to the server.set_server()
Connect the user to an available multiplayer server.
SignatureTypeScript contract
set_server(server_name: string): voidParameters
| Name | Type | Required | Description |
|---|---|---|---|
server_name | string | Yes | Server to connect to. Use get_servers() to obtain an available name. |
ExampleJavaScript
this.$api.community.set_server("USA East");Returns
voidNo direct return value is documented.