Modules
Modules are custom code that can be deployed inside Union Server. There are two types of modules: server modules and room modules.
Server modules add functionality to the entire server and are not associated with a specific room. For example, a server module might send an email to an administrator if the server's CPU usage exceeds 75%. Server modules are active for as long as the server is running. When the server is started, all server modules are also started; when the server is shut down, all server modules are destroyed.
Room modules add functionality to a room, and typically implement the logic for a particular application. For example, in a game of trivia a room module might advance questions and calculate scores. Each room module is associated with with a specific instance of a room, and is bound to that room's life cycle. When a room is created, its associated room modules are started; when a room is destroyed, its associated modules are also destroyed.
Modules can be written in Java or JavaScript, or any scripting language that has a Java scripting engine (eg. Javascript, Python, Ruby, PHP).
Modules written in Java have a main class file and any number of supporting class files. Modules written in JavaScript (or or other scripting languages) have a main script file and any number of supporting script files. All modules—whether they are written in Java or a scripting language—have full access to the Java API and the computer on which Union Server is running, subject to the limitations of the user that started the server. For example, all modules (even modules written in scripting languages such as JavaScript) can write to files on Union Server's local file system, connect to a database, load external data from the internet, or launch a Java thread.