forked from Kweebec_Network/core-vitals
61 lines
2.4 KiB
Markdown
61 lines
2.4 KiB
Markdown
# Commands
|
|
|
|
Currently one in-game admin command: `/networkcore`.
|
|
|
|
All subcommands are run by an in-world player. Console support isn't wired up yet.
|
|
|
|
## /networkcore status
|
|
|
|
Prints local server identity, Redis state, and the metrics endpoint.
|
|
|
|
Example output:
|
|
|
|
```
|
|
=== NetworkCore ===
|
|
Server id: lobby-3f2a91bd
|
|
Role: lobby
|
|
Players: 12
|
|
Known servers: 4
|
|
Metrics: http://127.0.0.1:9100/metrics
|
|
```
|
|
|
|
If you see `Network: not connected (Redis unavailable)`, NetworkCore failed to open the Redis connection at start. Check the server log for the underlying error and verify `redis.host` / `redis.port` / `REDIS_PASSWORD`.
|
|
|
|
## /networkcore servers
|
|
|
|
Lists every server NetworkCore currently knows about (including itself).
|
|
|
|
Example:
|
|
|
|
```
|
|
=== Network Servers ===
|
|
lobby-3f2a91bd | role=lobby | players=12
|
|
bridge_duel-9c1b22a4 | role=bridge_duel | players=8
|
|
bridge_duel-d8e09131 | role=bridge_duel | players=0
|
|
arena-1f4e0bcc | role=arena | players=3
|
|
```
|
|
|
|
This reads from the local cache - same source as `ServerRegistry.getServers()`. If a server is missing here, either it hasn't joined the network yet or it failed to heartbeat (see [06_ServerRegistry.md](06_ServerRegistry.md) for detection latency).
|
|
|
|
## /networkcore publish <channel> <json>
|
|
|
|
Publishes a raw JSON payload to a MessageBus channel. Dev/debug helper - useful for poking subscribers without writing test code.
|
|
|
|
```
|
|
/networkcore publish chat.global {"from":"console","text":"test"}
|
|
```
|
|
|
|
The JSON is parsed and wrapped in the standard envelope (with your auth token if configured) before being sent. If the JSON is malformed you'll get an error in chat.
|
|
|
|
This is dangerous in production - it lets anyone with command access spoof any message on any channel. Lock it down with permissions before exposing to non-admins.
|
|
|
|
## Permissions
|
|
|
|
Subcommand permissions aren't enforced yet. If your server runs HytalePerms, gate `/networkcore` behind an admin group at the command-routing layer.
|
|
|
|
## Things this command does *not* do (and why)
|
|
|
|
- **Restart Redis / reload config.** Restart the server. Reload is fragile - half-loaded state is worse than no state.
|
|
- **Kick a server out of the network.** Servers self-register and self-deregister. If you want a server gone, stop its process. If you need to "evict" it administratively, that's a separate ops tool.
|
|
- **Send a chat message to all servers.** This belongs in a chat plugin that uses MessageBus, not in the core admin command.
|