2023-08-25 20:10:09 -04:00
|
|
|
import { Message } from '@engine/network';
|
2023-08-26 19:55:27 -04:00
|
|
|
import { Input } from '@engine/systems';
|
2023-08-25 20:10:09 -04:00
|
|
|
|
|
|
|
export * from './MessageProcessor';
|
|
|
|
export * from './MessagePublisher';
|
|
|
|
export * from './MessageReceiver';
|
2023-08-26 19:55:27 -04:00
|
|
|
export * from './SessionManager';
|
|
|
|
export * from './SessionInputSystem';
|
2023-08-25 20:10:09 -04:00
|
|
|
|
|
|
|
export type SessionData = { sessionId: string };
|
|
|
|
|
|
|
|
export type Session = {
|
|
|
|
sessionId: string;
|
|
|
|
controllableEntities: Set<string>;
|
2023-08-26 19:55:27 -04:00
|
|
|
inputSystem: Input;
|
2023-08-25 20:10:09 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
export interface ServerMessage extends Message {
|
|
|
|
sessionData: SessionData;
|
|
|
|
}
|
2023-08-26 19:55:27 -04:00
|
|
|
|
|
|
|
export interface SessionManager {
|
|
|
|
uniqueSessionId(): string;
|
|
|
|
getSession(id: string): Session | undefined;
|
|
|
|
getSessions(): string[];
|
|
|
|
putSession(id: string, session: Session): void;
|
|
|
|
removeSession(id: string): void;
|
|
|
|
numSessions(): number;
|
|
|
|
}
|