Triweb Container
What is a Triweb Container?
Once a domain name is pointed at a relay server, for its visitors it becomes an empty container to which one or more triweb applications (TWAs) may be installed.
Triweb Containers:
- Allow for installation and management of TWAs,
- Provide runtime environment for TWAs,
- Allow users to make backups of the container that include the installed TWAs with their data, and provide an interface to import them back if needed.
Converting a domain to a triweb container
To make your domain a triweb container, simply login to its domain control panel and point it at a selected triweb relay server with a CNAME
or ALIAS
record. For this you can use our public triweb relay that is available on triweb.io
, or use your own private triweb relay server.
For example, if you are an administrator of the mydomain.example
domain, and want to convert it to a triweb container using our public relay, you can add the following record to the DNS system:
mydomain.example CNAME triweb.io.
mydomain.example CNAME triweb.io.
(a CNAME record for mydomain.example domain with "triweb.io." value)
Once a domain name is pointed at a triweb relay server, the web browsers of its visitors will receive and execute the Triweb Container Management Code.
Selecting a TWA to be autoinstalled
Triweb Container Managemement Code attempts to detect if any TWA was setup for the domain by a domain administrator by querying the DNS for TXT
records of a subdomain constructed by prefixing the main domain under which TWA is to be deployed with _triweb.
looking for a record that begins with the app
keyword to determine the URL of TWA manifest file.
Once the location of manifest file is determined, the container management code attempts to automatically install the referenced TWA into the container and once done, passes the execution to the TWA by loading its index.html
file.
For example, if the main domain is mydomain.example
, the DNS query would be for TXT records of _triweb.domain.example
. Such records may look as below:
_triweb.mydomain.example TXT "app https://dev.domain.example/a-twa/manifest.json"
_triweb.mydomain.example TXT "app https://dev.domain.example/a-twa/manifest.json"
From it, the container management code is able to determine that the URL of the TWA manifest file is https://dev.domain.example/a-twa/manifest.json
, and will try to fetch such manifest file and automatically install the TWA into the local web browser of the domain visitor.
Triweb.Container API
TWAs may perform operations on the container through the API that is made available to them through the Triweb.Container
namespace once they include the /.../triweb.js
file. For more details, pleas visit the Triweb GitHub repository.