smartsocket/ts/smartsocket.classes.smartsocketclient.ts

38 lines
1.2 KiB
TypeScript
Raw Normal View History

2016-08-07 12:58:20 +00:00
import * as plugins from "./smartsocket.plugins"
2016-08-09 09:42:21 +00:00
// import interfaces
2016-08-09 16:22:30 +00:00
import { ISocketFunctionCall } from "./smartsocket.classes.socketfunction";
import { ISocketRequestDataObject } from "./smartsocket.classes.socketrequest"
2016-08-09 09:42:21 +00:00
// import classes
2016-08-09 16:22:30 +00:00
import { SocketConnection } from "./smartsocket.classes.socketconnection";
2016-08-09 09:42:21 +00:00
import { SocketFunction } from "./smartsocket.classes.socketfunction";
2016-08-09 16:22:30 +00:00
import { SocketRequest } from "./smartsocket.classes.socketrequest";
2016-08-07 12:58:20 +00:00
/**
* interface for class SmartsocketClient
*/
export interface ISmartsocketClientOptions {
2016-08-09 09:42:21 +00:00
port: number;
url: string;
2016-08-07 12:58:20 +00:00
}
export class SmartsocketClient {
2016-08-09 16:22:30 +00:00
socketConnection:SocketConnection;
2016-08-09 21:37:25 +00:00
constructor(optionsArg:ISmartsocketClientOptions){
// TODO: implement Socket init
2016-08-09 09:42:21 +00:00
};
2016-08-09 16:22:30 +00:00
serverCall(functionNameArg:string,dataArg:ISocketFunctionCall){
let socketRequest = new SocketRequest({
side:"requesting",
originSocketConnection:this.socketConnection,
shortId:plugins.shortid.generate(),
funcCallData:{
funcName: functionNameArg,
funcDataArg:dataArg
}
});
2016-08-09 21:37:25 +00:00
socketRequest.dispatch();
2016-08-09 16:22:30 +00:00
}
2016-08-07 12:58:20 +00:00
}