Skip to content

server_implemetation

charliesan edited this page Oct 8, 2024 · 3 revisions

Runner, the most important part of Code-runner, has some very important features assigned to it. howvever, without being able specify the implementation or "protocall", Code cannot send infomation to the server.

This markdown document tells people / server or hardware developers how to implement Coderunner's server and how you can use it within your projects. for more infomation about the client, how it works and the code behind it, check out Code from the homepage of the wiki.

Note: this is only a how we "Finite" implement the official "reference" server and the steps we take to do so. this doesn't mean you should implement it the same way. so long as you get the main components down then everything else is up to you!

This implementation uses JSON to traverse data through the Project Management System from the client to the server.

some key infomation for the readers of this document. we use websockets to send and receive infomation to and from the server aswell as json.

When creating a project, all of the code should be popped into a "code/" folder for organsation, "though you can rename this to anything you wish" where the contents of the folder go as follows using a test project as a example.

code/test
test/build/<build files and executible>
test/<source files and or make/cmake/cargo/config varables>

the project ==must== have a json file containing a json array with the contents in order as from the source of the reference server:

    # make a list of the varibles we parsed from the JSON
    project_vars = [Sysver, Project_name, Entry_point, Output_Name, Project_Build_System]

from there, you must then write to a file inside the project directory next to the source files, a project_vars.json file so the server can start the build process with that file or let the user compile the project from scratch on the host system if needed.

however, when writing the directories, make sure that the /build directory exists as most of the programs that implement the server/client protocall might not do a check on whether the directory does exist before actually compiling the code related with the programming

now, when receiving the json from the client. make sure to iterate through all supported languages through with ether a match/switch statement or some implementation of your choosing. then make sure that when you run the compile steps for supported languages, compile the files into the /build directory so that the bin/exe files can be grabbed really easy.

though, if the language doesn't support being able to compile the file into the /build directory then running the build command in the folder and copying the contents to the build directory works regardless. anything works as long as it doesn't break XD

sending information to the project management system is as simple as sending json that's been formatted with the required keys to /PMS

you can find the json documentation here

Clone this wiki locally