/*!
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
///
import { EventEmitter } from 'events';
import { AnimationLike, Guid, UserLike } from '../../..';
import { Client, Connection, InitializeActorMessage, Message, Payloads, Protocols, SyncActor, SyncAnimation, SyncAsset } from '../../../internal';
declare type AssetCreationMessage = Message;
declare type AnimationCreationMessage = Message;
/**
* @hidden
* Class for associating multiple client connections with a single app session.
*/
export declare class Session extends EventEmitter {
private _conn;
private _sessionId;
private _peerAuthoritative;
private _clientSet;
private _actorSet;
private _assetSet;
private _assetCreatorSet;
/** Maps animation IDs to animation sync structs */
private _animationSet;
/** Maps IDs of messages that can create animations to the messages themselves */
private _animationCreatorSet;
private _userSet;
private _protocol;
private _disconnect;
private actorLastUpdate;
get conn(): Connection;
get sessionId(): string;
get protocol(): Protocols.Protocol;
get clients(): Client[];
get actors(): Partial[];
get assets(): Partial[];
get assetCreators(): Message[];
get animationSet(): Map>;
get animations(): IterableIterator>;
get animationCreators(): Message[];
get animationCreatorSet(): Map>;
get actorSet(): Map>;
get assetSet(): Map>;
get assetCreatorSet(): Map>;
get userSet(): Map>;
get rootActors(): Partial[];
get authoritativeClient(): Client;
get peerAuthoritative(): boolean;
client: (clientId: Guid) => Client;
actor: (actorId: Guid) => Partial;
user: (userId: Guid) => Partial;
childrenOf: (parentId: Guid) => Partial[];
creatableChildrenOf: (parentId: Guid) => Partial[];
/**
* Creates a new Session instance
*/
constructor(_conn: Connection, _sessionId: string, _peerAuthoritative: boolean);
/**
* Performs handshake and sync with the app
*/
connect(): Promise;
disconnect(): void;
/**
* Adds the client to the session
*/
join(client: Client): Promise;
/**
* Removes the client from the session
*/
leave(clientId: Guid): void;
private setAuthoritativeClient;
private recvFromClient;
private recvFromApp;
preprocessFromApp(message: Message): Message;
preprocessFromClient(client: Client, message: Message): Message;
sendToApp(message: Message): void;
sendToClients(message: Message, filterFn?: (value: Client, index: number) => any): void;
sendPayloadToClients(payload: Partial, filterFn?: (value: Client, index: number) => any): void;
isAnimating(syncActor: Partial): boolean;
cacheInitializeActorMessage(message: InitializeActorMessage): void;
cacheActorUpdateMessage(message: Message): void;
cacheAssetCreationRequest(message: AssetCreationMessage): void;
cacheAssetCreation(assetId: Guid, creatorId: Guid, duration?: number): void;
cacheAssetUpdate(update: Message): void;
cacheAssetUnload(containerId: Guid): void;
cacheAnimationCreationRequest(message: AnimationCreationMessage): void;
cacheAnimationCreation(creatorId: Guid, def: Partial): void;
cacheAnimationUpdate(update: Message): void;
cacheAnimationUnload(message: Message): void;
}
export {};
//# sourceMappingURL=session.d.ts.map