# Server (Remote) Missions

Missions can instead run on the server and stream commands to the client.

When the user selects the mission your server will be contacted and at that point you will be able to manage the mission system indefinitely until the user selects another mission manually.

{
  "title": "Connect to Server",
  "aircraft": ["H145"],
  "api_version": 0.1,
  "url": "localhost:9998"
}

A mission server may dynamically generate and apply mission descriptors as well as send other commands and observe status. The server is essentially just a websocket server which listens for the simulator to connect and then speaks a JSON RPC type protocol.

A very simple Mission Server Sample in node.js is included in the Tools folder

# Command sent from aircraft to the server

Message Description
{"control_msg": “hello”} After connecting the H145 will alert you that it is ready for you to send a mission
{"control_msg": “canceled_by_user”} The H145 is alerting you that the user has selected another mission and you are no longer active. The connection will disconnect after this message
{"remote_notify": "my_message_name", "params": [ 0, 99, 3 ]} Use of remote_notify command will emit events.

# Commands sent from the server to aircraft

Message Description
{"load_mission": MISSION_DESCRIPTOR} After connecting the H145 will alert you that it is ready for you to send a mission
{"exec_commands": COMMANDLIST} The H145 is alerting you that the user has selected another mission and you are no longer active. The connection will disconnect after this message

MISSION_DESCRIPTOR is simply the JSON (already parsed) which would normally be a flat file mission.

exec_commands enables you as the mission server to intervene at any time with logic.