2016-08-09 21:37:25 +00:00
|
|
|
/// <reference types="q" />
|
|
|
|
import * as plugins from "./smartsocket.plugins";
|
|
|
|
import { ISocketFunctionCall } from "./smartsocket.classes.socketfunction";
|
2016-08-09 09:42:21 +00:00
|
|
|
import { Objectmap } from "lik";
|
2016-08-09 21:37:25 +00:00
|
|
|
import { SocketConnection } from "./smartsocket.classes.socketconnection";
|
2016-08-09 09:42:21 +00:00
|
|
|
export declare type TSocketRequestStatus = "new" | "pending" | "finished";
|
|
|
|
export declare type TSocketRequestSide = "requesting" | "responding";
|
2016-08-09 21:37:25 +00:00
|
|
|
/**
|
|
|
|
* interface of constructor of class SocketRequest
|
|
|
|
*/
|
2016-08-09 09:42:21 +00:00
|
|
|
export interface SocketRequestConstructorOptions {
|
|
|
|
side: TSocketRequestSide;
|
2016-08-09 21:37:25 +00:00
|
|
|
originSocketConnection: SocketConnection;
|
|
|
|
shortId: string;
|
|
|
|
funcCallData?: ISocketFunctionCall;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* request object that is sent initially and may or may not receive a response
|
|
|
|
*/
|
|
|
|
export interface ISocketRequestDataObject {
|
|
|
|
funcCallData: ISocketFunctionCall;
|
|
|
|
shortId: string;
|
|
|
|
responseTimeout?: number;
|
2016-08-09 09:42:21 +00:00
|
|
|
}
|
|
|
|
export declare let allRequestingSocketRequests: Objectmap<SocketRequest>;
|
|
|
|
export declare let allRespondingSocketRequests: Objectmap<SocketRequest>;
|
|
|
|
export declare class SocketRequest {
|
|
|
|
status: TSocketRequestStatus;
|
|
|
|
side: TSocketRequestSide;
|
|
|
|
shortid: string;
|
2016-08-09 21:37:25 +00:00
|
|
|
originSocketConnection: SocketConnection;
|
|
|
|
requestData: ISocketRequestDataObject;
|
|
|
|
done: plugins.q.Deferred<{}>;
|
2016-08-09 09:42:21 +00:00
|
|
|
constructor(optionsArg: SocketRequestConstructorOptions);
|
2016-08-09 21:37:25 +00:00
|
|
|
dispatch(): plugins.q.Promise<{}>;
|
|
|
|
handleResponse(responseDataArg: ISocketRequestDataObject): void;
|
|
|
|
respond(dataArg: any): void;
|
2016-08-09 09:42:21 +00:00
|
|
|
}
|