more structure updates

This commit is contained in:
2016-08-12 03:22:36 +02:00
parent cb3d7f4d7b
commit da510eb87a
5 changed files with 41 additions and 17 deletions

View File

@@ -41,21 +41,17 @@ export class SocketRequest {
side: TSocketRequestSide;
shortid: string;
originSocketConnection:SocketConnection;
requestData: ISocketRequestDataObject;
funcCallData: ISocketFunctionCall
done = plugins.q.defer();
constructor(optionsArg: SocketRequestConstructorOptions) {
this.side = optionsArg.side;
this.shortid = optionsArg.shortId;
this.funcCallData = optionsArg.funcCallData;
if(this.side === "requesting"){
allRequestingSocketRequests.add(this);
} else {
allRespondingSocketRequests.add(this);
};
// build request and response dataArg
this.requestData = {
funcCallData:optionsArg.funcCallData,
shortId:optionsArg.shortId
}
};
// requesting --------------------------
@@ -64,7 +60,11 @@ export class SocketRequest {
* dispatches a socketrequest from the requesting to the receiving side
*/
dispatch(){
this.originSocketConnection.socket.emit("function",this.requestData);
let requestData:ISocketRequestDataObject = {
funcCallData:this.funcCallData,
shortId:this.shortid
}
this.originSocketConnection.socket.emit("function",requestData);
return this.done.promise;
};