Skip to main content

Class LocalJsonRequest

Saves a GZip-compressed JSON log to the local filesystem, providing an offline fallback when the PHP backend endpoint is unreachable.

public class LocalJsonRequest : IRequest

Inheritance​

Implements​

IRequest

Constructors​

LocalJsonRequest()​

Default constructor. Initializes a new instance without setting values.

public LocalJsonRequest()

LocalJsonRequest(string, string)​

Initializes a new instance of the LocalJsonRequest class with a file name and JSON data. Uses the default directory from DataCollectionSettings.

public LocalJsonRequest(string name, string data)

Parameters​

NameTypeDescription
namestringThe name to be used for the saved file.
datastringThe raw JSON content to save.

LocalJsonRequest(string, string, string)​

Initializes a new instance of the LocalJsonRequest class with a file name, JSON data, and directory path.

public LocalJsonRequest(string name, string data, string directory)

Parameters​

NameTypeDescription
namestringThe name to be used for the saved file.
datastringThe raw JSON content to save.
directorystringThe directory where the file will be saved.

Methods​

HandleRequest()​

Compresses the JSON payload and writes it to disk, generating a unique path if necessary.

public IEnumerator HandleRequest()

Returns​

IEnumerator

Remarks​

UserID is prepended to fileName to keep each participant's data in its own namespace on the shared study filesystem. Multiple participants may run scenarios on the same machine without restarting Unity, so without the prefix their files would collide and overwrite one another — violating the study protocol's requirement for per-participant data separation.

  • Constructors
    • LocalJsonRequest()
    • LocalJsonRequest(string, string)
    • LocalJsonRequest(string, string, string)
  • Methods
    • HandleRequest()