neuray Services: Processing Modules
The following illustration shows the neuray services processing flow when executing an HTTP request:
neuray Service Commands
When neuray Services receives a command request, it looks up the command by name in the registry:
- If found, the command, together with the supplied arguments, is sent to the neuray library for execution. Commands return a single neuray Services data type as a response or an error code and message.
- If the command is not found, neuray Services returns a command not found response.
About neuray service commands: neuray service commands are the core of RealityServer. Service commands have complete access to the neuray library to implement their functionality. Service commands are self descriptive and provide information about the arguments they expect and their type. Arguments are passed in as key/value pairs:
- The key is always a string.
- Values can be any of the neuray Services defined data types including custom types defined by the command itself.
Event Manager
neuray Services provides an event-based system where you can create and register handler classes which are called when particular events occur. You register events globally or associate them with a particular user state.
Global handlers are called whenever an event is triggered. State handlers are called when the event is fired by a command using that state. Handlers have direct access to the neuray library. neuray Services defines a small set of built-in events and users can add their own.
About built-in events: The following built-in events are shipped with RealityServer:
- PRE_COMMAND_EXECUTION
- Sent before a command is executed. These events are registered against a specific command name. They are able to modify command parameters. These can also deny command execution by returning false.
- POST_COMMAND_EXECUTION
- Sent after a command is executed. These events are registered against a specific command name. They are able to modify return results.
- PRE_RENDER
- Sent just before a render occurs.
- POST_RENDER
- Sent just after a render occurs. These events are supplied with the rendered canvas and can modify it.
- CHANGE_SCOPE
- Sent when a command changes the currently used scope.
- SCENE_EXPIRED
- Sent when a scene is about to expire and be flushed from the database.