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-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;
|
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>;
|
2018-03-19 09:00:11 +00:00
|
|
|
private socketServer;
|
2016-08-07 16:59:39 +00:00
|
|
|
constructor(optionsArg: ISmartsocketConstructorOptions);
|
2018-03-19 09:00:11 +00:00
|
|
|
setExternalServer: (serverType: "express" | "http", serverArg: any) => Promise<void>;
|
2016-08-07 16:59:39 +00:00
|
|
|
/**
|
2018-03-19 09:00:11 +00:00
|
|
|
* starts smartsocket
|
2016-08-07 16:59:39 +00:00
|
|
|
*/
|
2018-03-19 09:00:11 +00:00
|
|
|
start(): Promise<void>;
|
2017-10-09 08:28:18 +00:00
|
|
|
/**
|
2018-03-19 09:00:11 +00:00
|
|
|
* stops smartsocket
|
2017-10-09 08:28:18 +00:00
|
|
|
*/
|
2018-03-19 09:00:11 +00:00
|
|
|
stop(): 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
|
|
|
}
|