Synchronet v3.19b-Win32 (install) has been released (Jan-2022).

You can donate to the Synchronet project using PayPal.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
service:jsondb [2022/11/28 22:15] – Added information about requiring json-client.js in a JS script in order to use JSONClient, how to create a JSONClient object, and calling disconnect() Nightfoxservice:jsondb [2022/11/28 22:18] – Fixed links to other pages on the wiki Nightfox
Line 4: Line 4:
 \\ \\
 ===== Updating services.ini and json-service.ini ===== ===== Updating services.ini and json-service.ini =====
-Synchronet provides this via the script json-service.js (in the exec directory).  To enable the JSON service, add the following lines to your [['dir:ctrl']]/[['config:services.ini']] if not already there:+Synchronet provides this via the script json-service.js (in the exec directory).  To enable the JSON service, add the following lines to your ''[[dir:ctrl]]''/''[[config:services.ini]]'' if not already there:
 <file> <file>
 [JSON] [JSON]
Line 13: Line 13:
 Note the port number is 10088.  This is a common port number to use for the JSON service.\\ Note the port number is 10088.  This is a common port number to use for the JSON service.\\
 \\ \\
-For storing data to be accessed this way, Synchronet uses the concept of JSON "databases" Each JSON database is given a name and are configured in [['dir:ctrl']]/json-service.ini.  For instance, there is a one-liners script in xtrn/oneliners, and if you want to host one-liners, you would need these lines in ctrl/json-service.ini:+For storing data to be accessed this way, Synchronet uses the concept of JSON "databases" Each JSON database is given a name and are configured in ''[[dir:ctrl]]''/json-service.ini.  For instance, there is a one-liners script in xtrn/oneliners, and if you want to host one-liners, you would need these lines in ctrl/json-service.ini:
 <file> <file>
 [oneliners] [oneliners]
Line 23: Line 23:
  
 ===== Reading from & writing to a JSON database=====  ===== Reading from & writing to a JSON database===== 
-In a JavaScript mod/door/game (a 'client'), first you will need to have your script include json-client.js (in the [['dir:exec']]/[['dir:load']] directory).  Before you use JSONClient, add this to your JS script:+In a JavaScript mod/door/game (a 'client'), first you will need to have your script include json-client.js (in the ''[[dir:exec]]''/''[[dir:load]]'' directory).  Before you use JSONClient, add this to your JS script:
   require("json-client.js", "JSONClient");   require("json-client.js", "JSONClient");
 Then, create a JSONClient object.  When doing so, you will need to provide the server (host) name/IP address and the port number as parameters.  For example, to connect to your own BBS (you could use "127.0.0.1" or "localhost"): Then, create a JSONClient object.  When doing so, you will need to provide the server (host) name/IP address and the port number as parameters.  For example, to connect to your own BBS (you could use "127.0.0.1" or "localhost"):