WebSocket server instances API

This API provides access to

  • get the status about running instances
  • configure instances
  • start or stop instances

An instance opens an WebSocked endpoint at the configured port and delegates every received message to all assigned plugins. When an instance is running and am assigned plugin was changed then you need to restart the instance.

GET /instances

JSON Response

PropertyTypeDescription
instances Array<[InstanceInfo](#InstanceInfo)>

List of configured WebSocket instances and status information.

InstanceInfo

PropertyTypeDescription
id string

ID of the instance.

name string

Name of the instance.

port number

The used port number.

state string<[InstanceState](#InstanceState)>

The current state of the instance.

description string

The instance description

connectionCount number

Number of current active connections.

pluginTotalCount number

Number of total assigned plugins.

pluginActiveCount number

Number of active plugins.

plugins Array<string>

List of assigned plugins (IDs).

activePlugins Array<string>

List of active plugins (IDs).

InstanceState

  • starting
  • stopped
  • running
  • stopping
  • error

POST /instances/running/restart

Restart all running instances.

POST /instances/:instanceId/start

Start an instance.

POST /instances/:instanceId/stop

Stop an instance.

POST /instances/config

Create a new instance configuration.

JSON Request

PropertyTypeDescription
instanceConfig InstanceConfig

The instance configuration object.

InstanceConfig

PropertyTypeDescription
id string

The unique instance ID. Shall be URL safe.

name string

Instance name for display purpose.

description string

Instance description for display purpose.

port number

The WebSocket server instance port.

autoStartEnabled boolean

Start WebSocket instance automatically when YAKjs is started.

plugins Array<string>

List of assigned plugins (IDs) that shall be used by this instance.

PUT /instances/:instanceId/config

Updates an existing instance configuration.

JSON Request

PropertyTypeDescription
instanceConfig [InstanceConfig](#InstanceConfig)

The instance configuration object.

DELETE /instances/:instanceId/config

Deletes an existing instance configuration.