2017-10-09 08:40:59 +00:00
|
|
|
/// <reference types="node" />
|
2016-08-07 12:58:20 +00:00
|
|
|
/// <reference types="socket.io" />
|
2018-03-15 01:29:40 +00:00
|
|
|
import * as plugins from './smartsocket.plugins';
|
2017-10-09 08:40:59 +00:00
|
|
|
import * as http from 'http';
|
2017-07-07 20:02:19 +00:00
|
|
|
import { SocketConnection } from './smartsocket.classes.socketconnection';
|
|
|
|
import { SocketRole } from './smartsocket.classes.socketrole';
|
2018-03-15 01:29:40 +00:00
|
|
|
import * as SocketIO from 'socket.io';
|
2016-08-07 12:58:20 +00:00
|
|
|
export interface ISmartsocketConstructorOptions {
|
|
|
|
port: number;
|
|
|
|
}
|
|
|
|
export declare class Smartsocket {
|
2016-08-07 16:59:39 +00:00
|
|
|
options: ISmartsocketConstructorOptions;
|
2017-10-09 08:40:59 +00:00
|
|
|
httpServer: http.Server;
|
2016-08-07 12:58:20 +00:00
|
|
|
io: SocketIO.Server;
|
2018-03-15 01:29:40 +00:00
|
|
|
openSockets: plugins.lik.Objectmap<SocketConnection>;
|
|
|
|
socketRoles: plugins.lik.Objectmap<SocketRole>;
|
2016-08-07 16:59:39 +00:00
|
|
|
constructor(optionsArg: ISmartsocketConstructorOptions);
|
|
|
|
/**
|
2017-07-15 21:16:22 +00:00
|
|
|
* starts listening to incoming sockets:
|
2016-08-07 16:59:39 +00:00
|
|
|
*/
|
2017-10-09 08:40:59 +00:00
|
|
|
startServer(): Promise<{}>;
|
2017-10-09 08:28:18 +00:00
|
|
|
/**
|
|
|
|
* starts the server with another server
|
|
|
|
*/
|
2017-10-09 08:40:59 +00:00
|
|
|
setServer(httpServerArg: http.Server): Promise<void>;
|
2017-07-15 21:16:22 +00:00
|
|
|
/**
|
|
|
|
* closes the server
|
|
|
|
*/
|
|
|
|
closeServer(): Promise<void>;
|
2016-08-15 00:36:17 +00:00
|
|
|
/**
|
|
|
|
* allows call to specific client.
|
|
|
|
*/
|
2017-07-07 20:02:19 +00:00
|
|
|
clientCall(functionNameArg: string, dataArg: any, targetSocketConnectionArg: SocketConnection): Promise<{}>;
|
2016-09-04 22:34:09 +00:00
|
|
|
/**
|
|
|
|
* adds socketRoles
|
|
|
|
*/
|
|
|
|
addSocketRoles(socketRolesArray: SocketRole[]): void;
|
2017-07-07 20:02:19 +00:00
|
|
|
/**
|
|
|
|
* the standard handler for new socket connections
|
|
|
|
*/
|
|
|
|
private _handleSocketConnection(socketArg);
|
2016-08-07 12:58:20 +00:00
|
|
|
}
|