[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/management-protocol](https://jsprismarine.dev/api/@jsprismarine/management-protocol/index.md) / [ManagementServer](https://jsprismarine.dev/api/@jsprismarine/management-protocol/ManagementServer/index.md) / ManagementServer

# Class: ManagementServer

Defined in: [ManagementServer.ts:167](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/management-protocol/src/ManagementServer.ts#L167)

A running listener.

## Accessors

### clientCount

#### Get Signature

> **get** **clientCount**(): `number`

Defined in: [ManagementServer.ts:249](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/management-protocol/src/ManagementServer.ts#L249)

How many clients are connected.

##### Returns

`number`

***

### port

#### Get Signature

> **get** **port**(): `number`

Defined in: [ManagementServer.ts:243](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/management-protocol/src/ManagementServer.ts#L243)

The port the listener is bound to, which is the chosen one when the options asked for 0.

##### Returns

`number`

## Methods

### close()

> **close**(): `Promise`\<`void`\>

Defined in: [ManagementServer.ts:268](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/management-protocol/src/ManagementServer.ts#L268)

Disconnects every client and stops listening.

#### Returns

`Promise`\<`void`\>

***

### notify()

> **notify**\<`K`\>(`name`, `params`): `void`

Defined in: [ManagementServer.ts:259](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/management-protocol/src/ManagementServer.ts#L259)

Sends a notification to every connected client. Before the server has started, only
`server/status` is sent.

#### Type Parameters

##### K

`K` *extends* keyof [`Notifications`](https://jsprismarine.dev/api/@jsprismarine/management-protocol/mojangApi/index.md#notifications)

#### Parameters

##### name

`K`

The notification.

##### params

[`Notifications`](https://jsprismarine.dev/api/@jsprismarine/management-protocol/mojangApi/index.md#notifications)\[`K`\]

Its parameters by name, as Mojang's document declares them.

#### Returns

`void`

***

### listen()

> `static` **listen**(`options`): `Promise`\<`ManagementServer`\>

Defined in: [ManagementServer.ts:181](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/management-protocol/src/ManagementServer.ts#L181)

Starts listening.

#### Parameters

##### options

[`ManagementServerOptions`](https://jsprismarine.dev/api/@jsprismarine/management-protocol/ManagementServer/index.md#managementserveroptions)

Where to listen, the secret, and what to answer with.

#### Returns

`Promise`\<`ManagementServer`\>

The listener, once it is bound.
