Options
All
  • Public
  • Public/Protected
  • All
Menu

Typesafe way of using the JS-based State Managers from soundworks on server side. A server can ...

  • SET the STATEs
  • GET the STATEs explicitly (pull by server method)
  • GET the INPUTs implicitly on every change (push by client method)

Hierarchy

  • ServerStateGuard

Index

Constructors

constructor

Properties

controllerInputCallback

controllerInputCallback: (s: ControllerInputType, nodeId: string) => void = ...

Type declaration

    • Function that is called when input from a controller arrives. Has to be set in a controller server experience, outputs an error when not initialized.

      Parameters

      Returns void

inputStates

inputStates: Set<unknown> = ...

Holds record of every connected client input state (player & controller).

playerInputCallback

playerInputCallback: (s: PlayerInputType, nodeId: string) => void = ...

Type declaration

    • Function that is called when input from a player arrives. Has to be set in a player server experience, outputs an error when not initialized.

      Parameters

      Returns void

sharedAppState

sharedAppState: any = ...

State Manager that distributes settings for the whole app that concern controllers and players. Can only be changed on server side.

sharedControllerState

sharedControllerState: any = ...

State Manager that distributes settings that concern controllers. Can only be changed on server side.

sharedPlayerState

sharedPlayerState: any = ...

State Manager that distributes settings that concern players. Can only be changed on server side.

Methods

pullSharedAppState

  • Explicitly pulls the current AppState.

    Returns undefined | SharedAppType

    The AppState if it exists, undefined otherwise.

pullSharedControllerState

  • Explicitly pulls the current ControllerState.

    Returns undefined | SharedControllerType

    The ControllerState if it exists, undefined otherwise.

pullSharedPlayerState

  • Explicitly pulls the current PlayerState.

    Returns undefined | SharedPlayerType

    The PlayerState if it exists, undefined otherwise.

receiveControllerInput

  • receiveControllerInput(state: object, nodeId: any): void
  • Used as "person-in-the-middle" to ensure typesafety. Soundworks "state.subscribe()" method has to be registered with this function for every controller client that connects. It then get's forwarded, to the controllerInputCallback with correct type.

    Parameters

    • state: object

      The state as plain JS object type (build by a json string).

    • nodeId: any

      Id of the connected controller.

    Returns void

receivePlayerInput

  • receivePlayerInput(state: object, nodeId: any): void
  • Used as "person-in-the-middle" to ensure typesafety. Soundworks "state.subscribe()" method has to be registered with this function for every player client that connects. It then get's forwarded, to the playerInputCallback with correct type.

    Parameters

    • state: object

      The state as plain JS object type (build by a json string).

    • nodeId: any

      Id of the connected player.

    Returns void

setSharedAppState

  • Changes the app state. Every controller & player client is informed automatically.

    Parameters

    Returns void

setSharedControllerState

  • Changes the controller state. Every controller client is informed automatically.

    Parameters

    Returns void

setSharedPlayerState

  • Changes the player state. Every player client is informed automatically.

    Parameters

    Returns void

Generated using TypeDoc