ComoClient

Server-side representation of a ComoNode

Extends

Constructor

new ComoClient(node)

Description:
  • Constructs a new ComoClient instance

Source:
Parameters:
Name Type Description
node Client

Instance of soundworks client

Attributes

(readonly) audioBufferLoader

Description:
  • Instance of AudioBufferLoader

Source:
Overrides:
See:

(readonly) audioContext

Description:
  • Instance of AudioContext

Source:
Overrides:
See:

(readonly) audioScheduler

Description:
  • Instance of Scheduler, running in AudioContext timeline

Source:
Overrides:
See:

(readonly) components :Map.<String, ComoComponent>

Description:
  • List of registered components

Source:
Overrides:

(readonly) host

Description:
  • The underlying soundworks client or server instance.

Source:
Overrides:
See:

(readonly) id :String

Description:
  • Topological id (can be fixed between different restarts):

    • For browser clients: generated from soundworks node id, or user defined through query parameter, i.e. http://host.local?id=my-client-id
    • For node clients: hostname
    • For server: 'server' constant
Source:
Overrides:

(readonly) keyValueStore :KeyValueStoreClient

Source:

(readonly) nodeId :Number

Description:
  • Soundworks id, uniquely generated at runtime

Source:
Overrides:

(readonly) playerManager :PlayerManagerClient

Source:

(readonly) pluginManager

Description:
  • Accessor to the soundworks PluginManager

Source:
Overrides:
See:

(readonly) projectManager :ProjectManagerClient

Source:

(readonly) role :String

Description:
  • Role of the node, as defined in soundworks config

Source:
Overrides:

(readonly) runtime :'node'|'browser'

Description:
  • Runtime in which the node is running

Source:
Overrides:

(readonly) scheduler

Description:
  • Instance of Scheduler, running in arbitrary timeline

Source:
Overrides:
See:

(readonly) scriptManager :ScriptManagerClient

Source:

(readonly) sessionManager :SessionManagerClient

Source:

(readonly) soundbankManager :SoundbankManagerClient

Source:

(readonly) sourceManager :SourceManagerClient

Source:

(readonly) stateManager

Description:
  • Accessor to the soundworks StateManager

Source:
Overrides:
See:

Methods

(async) init()

Description:
  • The init method is part of the initialization lifecycle of the como node. Most of the time, this method will be implicitly executed by the ComoNode#start method.

    Note that will automatically call the init method of the soundworks host as well.

    In some situations you might want to call this method manually, in such cases the method should be called before the ComoNode#start method.`.

Source:
Overrides:
Example
import { Client } from '@soundworks/core/client.js';
import { ComoClient } from '@ircam/como';

const client = new Client(config);
const como = new ComoClient(client);
// optional explicit call of `init` before `start`
await como.init();
await como.start();

(async) requestRfc(executorNodeId, name, payloadopt) → {Promise.<any>}

Description:
  • Request a remote function call on a given node.

    Warning - This method should be considered protected and may be subject to change, use at your own risk.

Source:
Overrides:
To Do:
  • - Lazily attach to a peer node owned state to minimize network load - This could be integrated into soundworks
Parameters:
Name Type Attributes Default Description
executorNodeId Number

Id of the node that should execute the procedure

name String

Name of the procedure

payload Object <optional>
{}

Arguments of the procedure

Returns:

The return value of the remote procedure call

Type
Promise.<any>

(async) setProject(projectDirname)

Description:
  • Change the current project of the whole Como application.

    • Important Calling this method method on any node will change the project for all connected nodes.
    • Unstable The signature of this method is subject to change
Source:
Overrides:
Parameters:
Name Type Description
projectDirname String

Dirname of the project

setRfcHandler(name, callback)

Description:
  • Function to execute when a remote function call is requested on this node

    Warning - This method should be considered protected and may be subject to change, use at your own risk.

Source:
Overrides:
Parameters:
Name Type Description
name String

Name of the procedure

callback function

Function to be executed

setRfcResolverHook(name, callback)

Description:
  • Function executed by the requesting node when the rfc is settled to perform additional logic on rfc result before fulfilling the promise.

    Warning - This method should be considered protected and may be subject to change, use at your own risk.

Source:
Overrides:
Parameters:
Name Type Description
name *
callback *

(async) start()

Description:
  • The start method is part of the initialization lifecycle of the como node. This method will implicitly execute ComoNode#init method if it has not been called manually.

    Note that will automatically call the start method of the soundworks host as well.

Source:
Overrides:
Example
import { Client } from '@soundworks/core/client.js';
import { ComoClient } from '@ircam/como';

const client = new Client(config);
const como = new ComoClient(client);
// implicit execution of `init` method
await como.start();

(async) stop()

Description:
  • The stop method is part of the lifecycle of the como node. Notes:

    • will automatically call the stop method of the soundworks host as well.
    • most of the time, you should not have to call this method manually, mainly meant for testing purposes.
Source:
Overrides:
Example
import { Client } from '@soundworks/core/client.js';
import { ComoClient } from '@ircam/como';

const client = new Client(config);
const como = new ComoClient(client);
await como.start();
// ...
await como.stop();