User:Jacek Antonelli/Plugin System/Local and Remote Plugins

Introduction
This page describes local plugins and remote plugins from a moderately technical perspective. In particular, it focuses on the differences in how the two categories of plugins are run and connect to the viewer.

The basic difference between the two is that local plugins run on the same computer as the viewer, while remote plugins run on a different computer and connect to the viewer over the internet or LAN. But, there are also other important technical and usage differences to keep in mind.

Local Plugins
Local plugins are characterized by three things:
 * 1) They are launched by the viewer, either at startup or when the user chooses to activate them.
 * 2) They run alongside the viewer on the same computer.
 * 3) They connect to the viewer via.

Each local plugin has its own directory within the viewer's plugins directory (e.g. Imprudence/plugins/My_Plugin_v1.0). This directory contains the files that belongs to the plugin, including the script or executable to be launched, as well as any images, sounds, data or XML files, etc. that the plugin uses.

Within its directory, the plugin has freedom about the organization and naming of almost all of its files. However, there is one file which must be present in the plugin's top-level directory and named correctly: plugin.xml. This file must contain certain information about the plugin, in an XML format (the exact format is still to be determined). The viewer reads this information to find the plugin's name, version, description, the path to the executable file to launch, the script language or executable type, names and versions of other plugins it depends on, etc.

When the viewer starts up, it scans each plugin directory and reads the plugin.xml files. It uses this information to construct a list of available plugins, and allows the user to choose which ones to activate.

When a plugin is activated, the viewer uses the information about the executable type and path to the executable file to determine how to launch the plugin. The viewer has a list of scripting languages and executable type names, along with information about how to launch executables of each type. It matches the plugin's type with one of its stored types, and uses that information to launch the plugin executable. (If the viewer does not know how to handle the plugin's type, it would display a message to the user indicating such, and maybe allowing them to set up a new rule for handling that type.)

When launching a plugin, the viewer provides that plugin with the path to a file, as the only argument to the plugin executable. The viewer will be accepting connections through that socket, and the plugin must initiate the connection.

After that point, local plugins and remote plugins behave in the same way: they negotiate the connection format and options using the Plugin Link Negotiation Protocol, introduce themselves, and then start using the API to provide their functionality.

Remote Plugins
TBW