2017-07-07 20:02:19 +00:00
|
|
|
import * as plugins from './smartsocket.plugins';
|
|
|
|
import { ISocketFunctionCall } from './smartsocket.classes.socketfunction';
|
|
|
|
import { SocketConnection } from './smartsocket.classes.socketconnection';
|
|
|
|
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
|
|
|
}
|
2018-03-15 01:29:40 +00:00
|
|
|
export declare let allSocketRequests: plugins.lik.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;
|
2017-07-07 20:02:19 +00:00
|
|
|
done: plugins.smartq.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
|
|
|
|
*/
|
2017-07-07 20:02:19 +00:00
|
|
|
dispatch(): 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
|
|
|
}
|