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
|
|
|
}
|
2016-08-12 03:56:40 +00:00
|
|
|
export declare let allSocketRequests: Objectmap<SocketRequest>;
|
2016-08-09 09:42:21 +00:00
|
|
|
export declare class SocketRequest {
|
|
|
|
status: TSocketRequestStatus;
|
|
|
|
side: TSocketRequestSide;
|
|
|
|
shortid: string;
|
2016-08-09 21:37:25 +00:00
|
|
|
originSocketConnection: SocketConnection;
|
2016-08-12 03:56:40 +00:00
|
|
|
funcCallData: ISocketFunctionCall;
|
2016-08-09 21:37:25 +00:00
|
|
|
done: plugins.q.Deferred<{}>;
|
2016-08-09 09:42:21 +00:00
|
|
|
constructor(optionsArg: SocketRequestConstructorOptions);
|
2016-08-12 03:56:40 +00:00
|
|
|
/**
|
|
|
|
* dispatches a socketrequest from the requesting to the receiving side
|
|
|
|
*/
|
2016-08-09 21:37:25 +00:00
|
|
|
dispatch(): plugins.q.Promise<{}>;
|
2016-08-12 03:56:40 +00:00
|
|
|
/**
|
|
|
|
* handles the response that is received by the requesting side
|
|
|
|
*/
|
2016-08-09 21:37:25 +00:00
|
|
|
handleResponse(responseDataArg: ISocketRequestDataObject): void;
|
2016-08-12 03:56:40 +00:00
|
|
|
/**
|
|
|
|
* creates the response on the responding side
|
|
|
|
*/
|
|
|
|
createResponse(): void;
|
2016-08-09 09:42:21 +00:00
|
|
|
}
|