Skip to content

ServerOptions

Defined in: server/server.ts:103

optional auth?: AuthHook

Defined in: server/server.ts:106

Custom auth. Without it every connection is a guest with a resume token (ADR 0010).


optional clock?: Clock

Defined in: server/server.ts:144


optional dev?: boolean

Defined in: server/server.ts:146

Dev checks in table runtimes. Default: NODE_ENV !== 'production'.


optional devtools?: DevtoolsOption

Defined in: server/server.ts:153

The inspector (shoehive/devtools, ADR 0011). Off by default. true enables it outside production with a generated token, and the inspector URL is logged once at startup. In production it needs { enabled: true, allowInProduction: true, token } (a token of at least 32 characters), otherwise createServer throws.


games: readonly AnyGame[]

Defined in: server/server.ts:104


optional idleTableMs?: number

Defined in: server/server.ts:140

Close tables nobody has joined and nobody is seated at after this long. Default 10 minutes.


optional limits?: ServerLimits

Defined in: server/server.ts:143


optional logger?: Logger

Defined in: server/server.ts:113


optional origins?: readonly string[]

Defined in: server/server.ts:124

Allowed Origin headers for browser connections, for example ['https://play.example.com']; ['*'] allows any. Default: any origin, except in production with an auth hook, where only same-origin pages may connect (a browser sends a site's cookies with a cross-site WebSocket upgrade, so any web page could otherwise connect as a signed-in visitor). Clients that send no Origin (servers, native apps) are always allowed.


optional path?: string

Defined in: server/server.ts:115

WebSocket path. Default /shoehive.


optional reconnectGraceMs?: number

Defined in: server/server.ts:136

How long a seat is held after its player disconnects. Default 60 000 ms.


optional resumeTokenTtlMs?: number

Defined in: server/server.ts:138

Resume token lifetime, renewed on every connect. Default 7 days.


optional secret?: string | readonly string[]

Defined in: server/server.ts:108

HMAC secrets for resume tokens: the first signs, all verify. Defaults to SHOEHIVE_SECRET.


optional snapshotEvery?: number

Defined in: server/server.ts:142

Write a snapshot every N log entries (also on phase change and end). Default 100.


optional store?: Store

Defined in: server/server.ts:110

Where tables are persisted. Defaults to an in-memory store.


optional unknownUpgrades?: "ignore" | "refuse" | { refuseAfterMs: number; }

Defined in: server/server.ts:134

What attach() does with WebSocket upgrades for paths Shoehive does not serve. 'ignore' (default) leaves them to the HTTP server's other upgrade listeners. 'refuse' answers HTTP 404 and closes the socket at once: use it when Shoehive is the only WebSocket handler on that server. { refuseAfterMs } answers 404 after that long unless another listener has written to or closed the socket by then, which keeps other handlers working while still closing sockets nobody takes. listen() owns its HTTP server and always refuses at once.


optional wallet?: Wallet

Defined in: server/server.ts:112

Money backend (ADR 0007). Exposed to game code from Phase 4.