Architecture¶
If you have any feedback or question, don’t hesitate to contact us or to directly contribute to our Github
How it works¶
Here is a simple way to represent the Plugin System architecture:
+---------------------------------+ +-------------------------------------------------+
| +-----------+ | | |
| |Nanome User| | | |
| |"Alice" +<------------>+ |
|Room +-----------+ | | |
|"Alice's Room" +-----------+ | | |
| |Nanome User| | | |
| |"Bob" | | | NTS |
| +-----------+ | | |
+---------------------------------+ | - Session A: "Alice's Room" (Alice is presenter)|
+---------------------------------+ | - Session B: "Dan's Room" (Carol is presenter) |
| +-----------+ | | |
| |Nanome User| | | - Plugin A: Docking Plugin |
| |"Carol" +<------------>+ |
|Room +-----------+ | | |
|"Dan's Room" +-----------+ | | |
| |Nanome User| | | |
| |"Dan" | | | |
| +-----------+ | | |
+---------------------------------+ +---------------------^---------------------------+
|
+-------------------------------------+
| | |
| +------v-------+ |
| |Docking Plugin| |
| +^------------^+ |
| | | |
| +---------v-+ +v----------+ |
| |Sub-process| |Sub-process| |
| |(Session A)| |(Session B)| |
| +-----------+ +-----------+ |
+-------------------------------------+
- NTS (the plugin server) is aware of which plugins and sessions are connected to it, and who is the presenter of each session.
- A session asks to connect to a plugin
- NTS transfers the request to the target plugin
- The plugin creates a subprocess on its computer, and instantiates its plugin class
- The subprocess replies to its main process, which transfers the reply to NTS, which transfers the reply to the room presenter
- Connection is established until the presenter requests a disconnection or the plugin is stopped.
NB: A plugin cannot talk to a Nanome session/user before being connected to it. NB2: Communications are encrypted from Nanome to NTS and from NTS to Plugins
API Structure¶
The API is broken down into a few different submodules
nanome.api.plugin_instance
: Contains PluginInstance class, which provides interface for interacting with your Nanome workspacenanome.api.plugin
: Contains Plugin class, which manages networking and callbacks.nanome.api.structure
: Workspace API. Used for modeling atomic structures and representations.nanome.api.ui
: Build Menus and forms for your plugin.nanome.api.shapes
: Render shapes and lines in workspace.nanome.api.streams
: Real time updates to one or more objects in your workspace.nanome.api.util
: Enums, data structures, and utility functions used throughout our plugins.nanome.api.integrations
: Integrations allow plugins to hook into Nanome features (such as minimization or hydrogens calculations).nanome.api.macros
: Enable macro scripts written in Lua to be run (not yet documented).
Development iterations¶
As a result of this flexible architecture, no need to restart Nanome if your plugin crashes, or if you need to improve it:
- Stop your plugin. All sessions connected to it will be disconnected.
- Modify the python script
- Restart it
- Reconnect to it in Nanome. Using the 2D mode of Nanome might be useful in order to reconnect and test faster without having to wear your VR headset everytime.