Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Excerpt Include
BrightScript Version Navigation Menu
BrightScript Version Navigation Menu
nopaneltrue
This object allows for processing of RESTful HTTP/HTTPS requests from remote URLs to the embedded web server of the BrightSign player. Many of the requests are provided to the script as roHttpEvent objects for handling.

...

Code Block
CreateObject("roHttpServer", parameters As roAssociativeArray)

Currently, the The associative array can contain a single parameterthe following parameters:

  • [int] port: The port number of the embedded web server
  • [roAssociativeArray] http: A set of HTTPS configuration parameters:
    • [string] key_file: The name of a file containing the private key in PEM format. If neither the passphrase nor obfuscated_passphrase are passed, then the key file must be unencrypted.
    • [string] certificate_file: The name of a file containing the certificate in PEM format
    • [string] passphrase: The passphrase to decrypt the key file
    • [string] obfuscated_passphrase: The obfuscated passphrase to decrypt the key file. Contact support@brightsign.biz to learn more about generating a key for obfuscation and storing it on the player.
Note
titleNote

If the key and certificate are contained in a single file, it may be passed as the certificate_file (and the key_file can be omitted).


Code Block
titleExample
 server = CreateObject("roHttpServer", { port: 443, http: { certificate_file: "cert.pem", passphrase: "sekrit" } })


ifHttpServer

Each “Add” handler method described below takes an associative array as its parameter. Values in the associative array specify how the handler behaves. See the table at the end of this section for common key:value pairs.

...

The following table describes common key:value pairs for "Add" handler methods:

Name

Applies to

Value

url_path

All

The path for which the handler method will be used

user_data

GetFromEvent()
PostToString()
PostToFile()
MethodToString()

A user-defined value that can be retrieved by calling roHttpEvent.GetUserData()

method

AddMethodFromEvent()
AddMethodToFile()

The HTTP method associated with the generated roHttpEvent. The method type can then be retrieved using roHttpEvent.GetMethod().

passwords

All

An associative array that contains a mapping between usernames and passwords

auth

All

The authentication type to use when passwords are set. This value can be either "basic" or "digest". The value defaults to “digest” if not specified.

realm

All

The authentication realm, which will be displayed by web browsers when prompting for a username and password

headers

GetFromFile()

An associative array that contains arbitrary headers to be included with the automated response

content_type

GetFromFile()

The contents of the "Content-Type" header that is included with the automated response. This may not be set at the same time as the headers member. You can set both the MIME type and character set together (e.g. "text/plain; charset=utf-8")

body

GetFromString()

The response body

filename

GetFromFile()

The path to the file used for the response body.

destination_directory

PostToFile()

The path to the directory used for the temporary file containing the request body. A random filename will be generated automatically.

ifMessagePort

SetPort(port As roMessagePort)

...