/// <reference types="node" />
/// <reference types="ws" />
import { Server as HttpServer } from 'http';
import { Handle } from '@dojo/interfaces/core';
import Node from './executors/Node';
import Promise from '@dojo/shim/Promise';
import * as WebSocket from 'ws';
export default class Server implements ServerProperties {
    /** Executor managing this Server */
    readonly executor: Node;
    /** Base path to resolve file requests against */
    basePath: string;
    /** Port to use for HTTP connections */
    port: number;
    /** If true, wait for emit handlers to complete before responding to a message */
    runInSync: boolean;
    /** Port to use for WebSocket connections */
    socketPort: number;
    protected _codeCache: {
        [filename: string]: {
            mtime: number;
            data: string;
        };
    } | null;
    protected _httpServer: HttpServer | null;
    protected _sessions: {
        [id: string]: {
            listeners: ServerListener[];
        };
    };
    protected _wsServer: WebSocket.Server | null;
    constructor(options: ServerOptions);
    start(): Promise<void>;
    stop(): Promise<void>;
    /**
     * Listen for all events for a specific session
     */
    subscribe(sessionId: string, listener: ServerListener): Handle;
    private _getSession(sessionId);
    private _handleHttp(request, response);
    private _handleFile(request, response, shouldInstrument?, omitContent?);
    private _handleMessage(message);
    private _handleWebSocket(client);
    private _publish(message);
    private _send404(response);
}
export interface ServerProperties {
    basePath: string;
    executor: Node;
    port: number;
    runInSync: boolean;
    socketPort: number;
}
export interface ServerListener {
    (name: string, data: any): void;
}
export declare type ServerOptions = Partial<ServerProperties> & {
    executor: Node;
};
