client

Namespace

client

Description:
  • Client-side part of the soundworks framework.

    A soundworks client can run seamlessly in a browser or in a Node.js runtime.

    import '@soundworks/helpers/polyfills.js';
    import { Client } from '@soundworks/core/client.js';
    import launcher from '@soundworks/helpers/launcher.js';
    
    // - General documentation: https://soundworks.dev/
    // - API documentation:     https://soundworks.dev/api
    // - Issue Tracker:         https://github.com/collective-soundworks/soundworks/issues
    // - Wizard & Tools:        `npx soundworks`
    
    const config = window.SOUNDWORKS_CONFIG;
    
    async function main($container) {
      try {
        const client = new Client(config);
    
        // client.pluginManager.register(pluginName, pluginFactory, {options}, [dependencies])
    
        launcher.register(client, {
          initScreensContainer: $container,
          reloadOnVisibilityChange: false,
        });
    
        await client.start();
    
        $container.innerText = `client ${client.id} started`);
    
      } catch(err) {
        console.error(err);
      }
    }
    
    launcher.execute(main);
    
Source:

Classes

Client
Context
ContextManager
Plugin
PluginManager
SharedState
SharedStateCollection
Socket
StateManager

Type Definitions

BrowserClientConfig

Description:
  • Configuration object for a client running in a browser runtime.

Source:
Properties:
Name Type Attributes Description
role string

Role of the client in the application (e.g. 'player', 'controller').

app object <optional>

Application configration object.

Properties
Name Type Attributes Default Description
name string <optional>
''

Name of the application.

author string <optional>
''

Name of the author.

env object <optional>

Environment configration object.

Properties
Name Type Attributes Default Description
websockets string <optional>
{}

Configuration options for websockets.

subpath string <optional>
''

If running behind a proxy, path to the application.

Configuration object for a client running in a browser runtime.

Type:
  • object

NodeClientConfig

Description:
  • Configuration object for a client running in a node runtime.

Source:
Properties:
Name Type Attributes Description
role string

Role of the client in the application (e.g. 'player', 'controller').

app object <optional>

Application configration object.

Properties
Name Type Attributes Default Description
name string <optional>
''

Name of the application.

author string <optional>
''

Name of the author.

env object

Environment configration object.

Properties
Name Type Attributes Default Description
serverAddress boolean

Domain name or IP of the server.

useHttps boolean

Define is the server run in http or in https.

port boolean

Port on which the server is listening.

websockets string <optional>
{}

Configuration options for websockets.

subpath string <optional>
''

If running behind a proxy, path to the application.

Configuration object for a client running in a node runtime.

Type:
  • object