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
|
|||||||||||||||
env |
object |
<optional> |
Environment configration object. Properties
|
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
|
||||||||||||||||||||||||||||||
env |
object | Environment configration object. Properties
|
Configuration object for a client running in a node runtime.
Type:
- object