krpc-node
A node.js client library for krpc. Allows you to send commands to Kerbal Space Program from node. Browser support coming soon!
JavaScript to space via krpc!
Image by Rareden, for more, visit this forum link
Table of Contents
- Client
- Example Code
- More Examples
- Legacy Mode - Backwards Compatibility
- Services:
- KRPC - Api for interacting with the kRPC server.
- SpaceCenter - Main api for controlling KSP.
- Drawing - Api for for drawing objects in the flight scene.
- UI - Api for interacting with user interface elements.
- InfernalRobotics - Api for interacting with the Infernal Robotics mod.
- KerbalAlarmClock - Api for interacting with the Kerbal Alarm Clock mod.
- RemoteTech - Api for interacting with the Remote Tech mod.
- ToDo
Example code
For more details on how to use the client, please see the above link, a quick getting started example is below:
'use strict';let createClient spaceCenter = ; ;
You can also setup a stream that will update values on a ticker:
let createClient spaceCenter = ;let _ = ; ;
More Examples
Checkout the examples repository for some practical examples. Alternatively the tests in this code base can also be a good source of information.
To learn the history of the library and see me and it in action you can also check out the video below from the JSinSA 2017 conference. For more info on the JSinSA conference, check out this link
Legacy
To make sure your old code works with version 4.x of the library, simply create the client as follows:
; { // Z0mg Code!}
Please note, this will be deprecated in version 5+
ToDo
- Update the code which generates the documentation & services to generate documentation for the new object hierarchy.
- Automatically run prettier after generating documentation.
- Implement wait events like in the python client.
- Decide on dynamically updating the client's services when connecting to a host