HTML5 Builds
You can host your Corona HTML5 builds directly on your Coronium Core server in the Pages directory.
This also allows you to access your custom built server-side APIs using the CoroniumJS plugin.
Click here to watch a screencast.
Hosting HTML5 Builds
To host your HTML5 game or app, create a directory in the /home/coronium/pages directory and upload your Corona HTML5 output.
The game or app will be available at:
http[s]://your.coronium.server/<html5-app-directory>
To access the debug build use:
http[s]://your.coronium.server/<html5-app-directory>/index-debug.html
Using CoroniumJS
Using the CoroniumJS plugin in your Corona HTML5 project gives you access to your custom server-side APIs. The plugin will be enhanced over time to allow for more functionality.
Requires Corona daily build 2018.3276 or higher.
Download
You can download the most recent CoroniumJS plugin by clicking here.
Install
Expand the archive, and then move the coroniumjs_js.js and coroniumjs.lua files the root of your Corona HTML5 project directory.
Your directory tree should look something like:
<corona_project>/ coroniumjs_js.js coroniumjs.lua main.lua ...
Require
In your main.lua (or wherever needed):
local corejs = require("coroniumjs")
CoroniumJS API
init
Initialize the CoroniumJS plugin.
corejs.init( config_tbl )
Parameters
Name | Description | Type | Required |
---|---|---|---|
config_tbl | The configuration table for the plugin initialzation. | Table | Y |
Config Table Keys
Name | Description | Type | Required |
---|---|---|---|
key | The Coronium Core server key. | String | Y |
scope | A unique application name for your Corona project. See Application Scope in the client guide. | String | Y |
api | The server-side API Project name to run api methods against (see Server-side API). | String | Y |
Example
corejs.init({ key = '<coronium-server-key>', scope = 'FunRun', api = 'game' })
Note
The CoroniumJS plugin will only work with HTML5 projects hosted on a Coronium Core server.
api
Call a custom server-side API method. Works like the standard client core.api method.
corejs.api.<method-name>([input_params,] listener)
Parameters
Name | Description | Type | Required |
---|---|---|---|
input_params | A key/value table of parameters for the method. | Table | Y |
listener | The response listener callback function. | Function | Y |
Example
local function apiResponse( evt ) if evt.error then print(evt.error) else print(evt.result.name) -- Jimmy end end corejs.api.test({name="Jimmy"}, apiResponse)
debug
Pretty print the response event to the console. Useful for debugging.
corejs.debug(response_event)
Example
local function apiResponse( evt ) corejs.debug( evt ) ... end