# CyberM.network — client runtime

Runs inside the game process. Reads and presentation are local; anything that changes shared state has to go through the server.

7 functions.

## catalog

```lua
CyberM.network.catalog()
```

`NETWORK` — Uses the network backend.

The catalog as of the last refresh.

Reads a snapshot: refreshing is asynchronous, so call `refresh`, then `catalog` a beat later.

Returns: `table { phase, generation, servers… }`

Registered in `ResourceHost.cpp` (line 6568) as `LuaNetworkCatalog`.

## connect

```lua
CyberM.network.connect(endpoint, [name])
```

`NETWORK` — Uses the network backend.

Joins a CyberM server.

Starts a connection to the supplied CyberM server endpoint using the current identity and resource pipeline. It requires `network.client`; success means the request was accepted, while connection progress and errors are observed through `status()`.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `endpoint` | `string` | required | — |
| `name` | `string` | optional | — |

Returns: `true when the request is accepted`, `reason for the refusal`

```lua
local ok, reason = CyberM.network.connect("127.0.0.1:11778", "Player")
```

Registered in `ResourceHost.cpp` (line 6569) as `LuaNetworkConnect`.

## disconnect

```lua
CyberM.network.disconnect()
```

`NETWORK` — Uses the network backend.

Leaves the current server.

Requests an orderly disconnect with an optional diagnostic reason. It returns after queuing teardown; the session phase in `status()` is the authoritative view of when cleanup has completed.

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6570) as `LuaNetworkDisconnect`.

## identity

```lua
CyberM.network.identity()
```

`NETWORK` — Uses the network backend.

Reads the local Master-backed identity profile state.

Returns the durable user id, current display name, registration state, and asynchronous update phase. The private key is never exposed. This bridge exists for the trusted local server browser; server-downloaded resources should use the verified player APIs instead.

Returns: `table { phase, generation, userId, displayName, error, registered }, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6573) as `LuaNetworkIdentity`.

## identityUpdate

```lua
CyberM.network.identityUpdate(catalogUrl, displayName)
```

`NETWORK` — Uses the network backend.

Requests a signed username update from the Master.

Queues the HTTP enrollment on the networking worker and returns immediately. Poll `identity()` until the matching generation becomes `ready` or `failed`. The backend is deliberately available only to the trusted system server-browser resource and refuses updates during a live session.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `catalogUrl` | `string` | required | — |
| `displayName` | `string` | required | — |

Returns: `true when queued, otherwise false`, `reason`

Registered in `ResourceHost.cpp` (line 6572) as `LuaNetworkIdentityUpdate`.

## refresh

```lua
CyberM.network.refresh([url])
```

`NETWORK` — Uses the network backend.

Asks the directory for the server catalog again.

Starts a master-server catalog refresh for the supplied URL and requires `network.client`. The call only accepts the request; use `catalog()` to inspect generation, phase, HTTP status, body and error.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `url` | `string` | optional | — |

Returns: `boolean`, `reason`

Registered in `ResourceHost.cpp` (line 6567) as `LuaNetworkRefresh`.

## status

```lua
CyberM.network.status()
```

`NETWORK` — Uses the network backend.

State of the network session.

Returns the current client session snapshot: phase, endpoint, authenticated player identity, routing bucket, rates, server time, ping and downloaded resource-set metadata. Reading it does not initiate a connection or wait for a phase change.

Returns: `table { phase, endpoint, playerId, routingBucket, ping, error }`

Registered in `ResourceHost.cpp` (line 6571) as `LuaNetworkStatus`.

