shoehive
Version:
WebSocket-based multiplayer game framework for real-time, event-driven gameplay
38 lines (37 loc) • 2.24 kB
TypeScript
/// <reference types="node" />
import { Player } from "./core/Player";
import { Table, TableState } from "./core/Table";
import { Card, CardSuit, CardRank, Deck, Hand } from "./core/card/index";
import { Seat } from "./core/Seat";
import { TableFactory } from "./core/TableFactory";
import { WebSocketManager } from "./core/WebSocketManager";
import { EventBus } from "./events/EventBus";
import { MessageRouter } from "./events/MessageRouter";
import { GameManager, GameDefinition } from "./core/GameManager";
import { Lobby } from "./core/Lobby";
import { AuthModule, ServerTransportModule, TransportModule } from "./transport";
import { CLIENT_COMMAND_TYPES, CLIENT_MESSAGE_TYPES } from "./core/commands/index";
import * as http from "http";
import { PLAYER_EVENTS, TABLE_EVENTS, LOBBY_EVENTS, EVENTS, PlayerEventType, TableEventType, LobbyEventType, BuiltInEventType, CustomEventMap, EventType, EventPayloadMap } from "./events";
export { Player, Table, Seat, TableState, TableFactory, WebSocketManager, EventBus, MessageRouter, GameManager, GameDefinition, Lobby, AuthModule, ServerTransportModule, TransportModule, CLIENT_COMMAND_TYPES, CLIENT_MESSAGE_TYPES, PLAYER_EVENTS, TABLE_EVENTS, LOBBY_EVENTS, EVENTS, PlayerEventType, TableEventType, LobbyEventType, BuiltInEventType, CustomEventMap, EventType, EventPayloadMap, Card, CardSuit, CardRank, Deck, Hand };
export declare function createGameServer(server: http.Server, authModule?: AuthModule, serverTransportModule?: ServerTransportModule, options?: {
/**
* Optional timeout in milliseconds for player reconnection.
* When a player disconnects, their game state is preserved for this duration.
* If they reconnect within this time, they continue from where they left off.
* If they don't reconnect within this time, they are removed from the game.
* Default is 600000 (10 minutes). Set to 0 to disable reconnection.
*/
reconnectionTimeoutMs?: number;
}): {
eventBus: EventBus;
messageRouter: MessageRouter;
tableFactory: TableFactory;
gameManager: GameManager;
lobby: Lobby;
wsManager: WebSocketManager;
transport: {
auth: AuthModule | undefined;
server: ServerTransportModule | undefined;
};
};