ParelVRDocs
Player site

Scripting / Reference

Web

Types in the ParelVR.Volt.Web namespace.

VoltStringDownloader#

ParelVR.Volt.Web.VoltStringDownloader static

Loads text from the web. The same rules as VoltWeb apply.

VoltStringDownloader methods#

static VoltWebRequest Load(VoltUrl url)

Loads the text at an address.

VoltUrl#

ParelVR.Volt.Web.VoltUrl class

A web address. Only https addresses of public hosts are valid.

VoltUrl constructors#

new VoltUrl(string url)

Wraps an address. An address that is not valid can be created but is refused when it is used.

VoltUrl properties#

string Host { get; }

The host part of the address, in lower case.

bool IsValid { get; }

True when the address is a plain https address of a public host.

string Value { get; }

The address as text.

VoltWeb#

ParelVR.Volt.Web.VoltWeb static

Controlled access to the web. Requests are https only, go to hosts the world declared when it was built, are limited in number, size and time, and never carry anything that identifies the player.

VoltWeb methods#

static VoltWebRequest Get(VoltUrl url)

Requests an address and returns at once; the answer arrives later.

static bool IsAllowed(VoltUrl url)

True when the world may send requests to the address.

static VoltWebRequest Post(VoltUrl url, string body, string contentType)

Sends text to an address.

static VoltWebRequest PostJson(VoltUrl url, VoltData body)

Sends structured data to an address as JSON.

VoltWebRequest#

ParelVR.Volt.Web.VoltWebRequest class

A web request in progress. Yield it in a coroutine to wait for the answer, or override OnWebResponse on the behaviour that started it.

VoltWebRequest properties#

VoltError Error { get; }

Why the request failed.

bool IsDone { get; }

True once the request has finished, whatever the result.

VoltWebResponse Response { get; }

The answer. Null until the request is done, and when no answer arrived.

bool Success { get; }

True when an answer with a success status arrived.

string Text { get; }

The body of the answer as text, or an empty string.

string Url { get; }

The address that was requested.

VoltWebResponse#

ParelVR.Volt.Web.VoltWebResponse class

The answer to a web request.

VoltWebResponse properties#

string ContentType { get; }

The content type the server reported.

bool IsSuccess { get; }

True for a status from 200 to 299.

int StatusCode { get; }

HTTP status code.

string Text { get; }

The body as text.