Nocheto HTTP API
It is ment to be a API for programmers, who wants to extend nocheto functionality. For example, you can create chess board in browser by the mans of HTML, CSS and JavaScript (as shown in example below), or browser extension which opens chess game/position from you favorite website directly in nocheto, runs analyze, get back the result and displays it.
Nocheto also provides simple HTTP server, which you can use to deliver HTML, CSS, JS or other files to user's browser (see example below).
HTTP API is disabled by default, you need to enable it by http command.
It is available sinc version 2.4.0 as experimental feature. You need to run nocheto with --future option to get http command.
API version
Nocheto 2.4.0 contains API version 0.1. This version is not documented, but you can download and study example v 0.1 application, see below.
Nocheto 2.5.0 contains API version 0.2. This version is not documented, but you can download and study example v 0.2 application, see below.
Section [http]2.0.0
There is a description of [http] config section.
Add the following section into your configuration file
(~/.nocheto/config/nocheto.ini
)
and the properties as required.
[http]
port = 8080
address = "127.0.0.1"
whitelist = "new;move;flipboard;uu;redo;r;r<;r>;goto;cut;delete;branchup;loadresults;lr;hint;analyze;nag;setnag;comment;bcomment;level;seconds;autoplay;setoption;board;b;undo;u;moves;play;p;switchsounds;fen;tag;stop;speach;echo;ipv4;quit"
rootdir="/home/<your home dir>/.nocheto/http/"
requestlogfile=""
Now you can run http command and open corresponding url in your browser (for example http://127.0.0.1:8080/).
port2.0.0
port="8080"
Port number where nocheto will accept HTTP connections.
address2.0.0
address="127.0.0.1"
IP address where nocheto will accept HTTP connections.
Use 0.0.0.0 for all available addresses.
whitelist2.0.0
whitelist = "new;move;flipboard;uu;redo;r;r<;r<<;r>;goto;cut;delete;branchup;loadresults;lr;hint;analyze;nag;setnag;comment;bcomment;level;seconds;autoplay;setoption;board;b;undo;u;moves;play;p;switchsounds;fen;tag;quit;stop;speach;echo"
List of commands accepted by nocheto through HTTP api.
rootdir2.0.0
rootdir = "<$HOME>/.nocheto/http/"
Root directory for files provided by nocheto through HTTP API.
Default is .nocheto/http/
directory in your home directory.
requestlogfile3.0.0
requestlogfile=""
Path to a file where nocheto will log HTTP requests (if set).
Example v 0.12.4.0
Download: http_0.1.zip.
Unpack the zip archive and move the http/
directory into ~/.nocheto/
directory.
Example v 0.22.5.0
Download: http_0.2.zip.
Install instructions are the same like in Example v 0.1 above.