|
CSIRO_WORKSPACEWEB_API int | server_init (int logLevel) |
|
CSIRO_WORKSPACEWEB_API int | server_listen_for_connection (const char *host, int port, NewConnectionCallback callback) |
|
CSIRO_WORKSPACEWEB_API int | server_listen_for_connection_and_wait (const char *host, int port, NewConnectionCallback callback) |
|
CSIRO_WORKSPACEWEB_API int | server_poll (int timeoutMs) |
|
CSIRO_WORKSPACEWEB_API int | server_start_event_loop (EventLoopStartedCallback callback) |
|
CSIRO_WORKSPACEWEB_API int | server_stop_event_loop () |
|
CSIRO_WORKSPACEWEB_API int | workspace_cancel_watch (const WorkspaceId *ws, const char *watchId) |
|
CSIRO_WORKSPACEWEB_API int | workspace_list_global_names (const WorkspaceId *ws, ListCallback callback) |
|
CSIRO_WORKSPACEWEB_API int | workspace_list_inputs (const WorkspaceId *ws, ListCallback callback) |
|
CSIRO_WORKSPACEWEB_API int | workspace_list_outputs (const WorkspaceId *ws, ListCallback callback) |
|
CSIRO_WORKSPACEWEB_API int | workspace_register_func_error (const WorkspaceId *ws, WorkspaceErrorCallback callback) |
|
CSIRO_WORKSPACEWEB_API int | workspace_register_func_failed (const WorkspaceId *ws, WorkspaceFailedCallback callback) |
|
CSIRO_WORKSPACEWEB_API int | workspace_register_func_success (const WorkspaceId *ws, WorkspaceSucceededCallback callback) |
|
CSIRO_WORKSPACEWEB_API int | workspace_run_continuously (const WorkspaceId *ws) |
|
CSIRO_WORKSPACEWEB_API int | workspace_run_once (const WorkspaceId *ws) |
|
CSIRO_WORKSPACEWEB_API int | workspace_set_global_name (const WorkspaceId *ws, const char *globalName, const char *content) |
|
CSIRO_WORKSPACEWEB_API int | workspace_set_input (const WorkspaceId *ws, const char *inputName, const char *content) |
|
CSIRO_WORKSPACEWEB_API int | workspace_stop (const WorkspaceId *ws) |
|
CSIRO_WORKSPACEWEB_API int | workspace_terminate (const WorkspaceId *ws) |
|
CSIRO_WORKSPACEWEB_API int | workspace_watch (const WorkspaceId *ws, JSONString watches, WatchCallback func, bool singleShot) |
|
Declares the C API to our WorkspaceWeb library. This allows external applications or environments (such as the workspaceweb python module) to interact with a running workspace.
The API operations in a client/server manner. One server is created in the application, which will then listen for running WorkspaceWeb instances (clients) which will then connect to it over TCP/IP. In most cases, the application itself will also be responsible for spawning the WorkspaceWeb instances as child processes.
The best way to use the API is asynchronously. This can be done as follows:
1) Initialise the server: server_init() 2) Register callbacks for success, failure, error, watch and most importantly, new connections. 3) Listen for new connections: server_listen_for_connection() Each new connection will result in a callback to the application, with the connected client address and port (WorkspaceId) provided as arguments. 4) Launch one or more workspace-web applications (optional - these may already exist and be running elsewhere on the network). 5) Register one or more watches on inputs / outputs / globalNames in the workflow using workspace_register_watch. 6) Set / get any inputs or global names on your workflow using workspace_set_input or workspace_set_global_name. 7) Use server_poll() to check for any updates.